After screening, Java back-end is key to adopt the following steps:
KeyGenerator. Init (128, new SecureRandom ( keyBytes ));
SecretKey sk=keyGenerator. GenerateKey ();
SecretKeySpec SecretKeySpec=new SecretKeySpec (sk) getEncoded (), "the AES) conversion;
The front-end js. The key is to use the key=CryptoJS enc. Utf8, parse (" XXXXXXXXXXXXXXXX ");//16
Such Java back-end if direct use SecretKeySpec SecretKeySpec=new SecretKeySpec ( keyBytes , "AES) can decrypt, but now cannot be modified after the end, so I want to ask next js front-end have corresponding keyGenerator. GenerateKey (); Method, not unable to decrypt by then end,
CodePudding user response:
The building Lord, I set of back-end encryption to decrypt the front-end, decryption failure, do not know what reasonCodePudding user response: