Home > front end >  AES encryption, key generation, the day after tomorrow to JS, have not
AES encryption, key generation, the day after tomorrow to JS, have not

Time:05-14

The keygen=KeyGenerator. GetInstance (AES, "");
The keygen. Init (128);
//generate keys
Deskey=the keygen. GenerateKey ();
//parsing deskey into an array using the array to initialize SecretKeySpec
Byte [] the encryptKey=deskey. GetEncoded ();
StrEncryptKey=new String (the encryptKey);

Var. Key=CryptoJS enc. Utf8. Parse (e);
Var=CryptoJS iv. Enc. Utf8. Parse (" 1111111111111111 ");
Var encrypted=CryptoJS. AES. Encrypt (account, key, {iv: iv, mode: CryptoJS. Mode. CBC});
After key generation, and I send this byte array using the new String (); Return to the JS, I use in JS cryptoJS widgets, encrypt, ready to each encryption, ajax get keys from the background dynamically, to the front desk encryption, finally the background decryption,
Excuse me the background of the 16 key is generated by the generateKey, how can whole incoming JS, encrypted?

CodePudding user response:

Var. Key=CryptoJS enc. Latin1. Parse (XXXX); The background generated key is not utf-8 can String you look at the utf-8 is stil

CodePudding user response:

The building Lord, your problem solved? I met the same problem with you recently
  • Related