When using crypto JS to decrypt, an error may be reported:
Malformed UTF-8 data
Error: Malformed UTF-8 data
at Object.stringify (d:\StudeyCode\myStudy\encryptDemo\routes\encrypt\crypto-js.js:478:27)
at WordArray.init.toString (d:\StudeyCode\myStudy\encryptDemo\routes\encrypt\crypto-js.js:215:41)
at decryptByDESModeCBC (d:\StudeyCode\myStudy\encryptDemo\routes\encrypt\crypto.js:90:22)
at testSign (d:\StudeyCode\myStudy\encryptDemo\routes\test.js:34:18)
at Layer.handle [as handle_request] (d:\StudeyCode\myStudy\encryptDemo\node_modules\express\lib\router\layer.js:95:5)
at next (d:\StudeyCode\myStudy\encryptDemo\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (d:\StudeyCode\myStudy\encryptDemo\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (d:\StudeyCode\myStudy\encryptDemo\node_modules\express\lib\router\layer.js:95:5)
at d:\StudeyCode\myStudy\encryptDemo\node_modules\express\lib\router\index.js:281:22
at Function.process_params (d:\StudeyCode\myStudy\encryptDemo\node_modules\express\lib\router\index.js:335:12)
The reason for the error is: when des decrypts, if the encrypted data is not an integral multiple of 8, the above error will be reported,
solution: encrypt the data, and then encrypt it with Base64. When decrypting, first decrypt it with Base64, and then decrypt it with DES. The above problems can be solved.
Read More:
- nodejs Error: Cannot find module ‘ejs‘
- Module parse failed:Unexpectedtoken (1:0)You may need an appropriate loader to handle this file type
- Module build failed: Error: ENOENT: no such file or directory, scandir,‘node_modules\node-sass\vend’
- [nodejs] error request aborted after request routing in post mode
- gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildPr
- Typical error log for IPSec ACL mismatch
- Events.js:167 throw er appears when starting node service under linux; // Unhandled ‘error’ event solution
- Error: cannot find module HTTP errors
- Module build failed: error: cannot find module ‘node sass’ error
- Miscellaneous Notes (2)
- Login authority verification
- Error failed to compile with 1 errors
- Example of public key signature and verification generated with fabric case
- Node.js Cannot find module ‘mysql’ ‘express’
- NPM and Node.js Version incompatibility
- Some mistakes in using NPM
- Error: can’t resolve ‘FS’ in (webpack 2 configures CSS loaders)
- Mybatis automatically generated SQL error
- Error: ENOENT: no such file or directory, uv_cwd Error: Cannot find module