CryptoJS encrypts AES with a passphrase, but a key is required to decrypt PHP

I use CryptoJS to encrypt the string:

  function doHash(msg){
    msg = String(msg);
    var passphrase = 'aggourakia';
    var hash = CryptoJS.AES.encrypt(msg, passphrase);
    var ciphertext=  hash.ciphertext.toString(); //return ciphertext instead of object
    return ciphertext;      
}

As I understand it, CryptoJS uses a passphrase to generate a key, which is then used to encrypt data.

However, I would like to decrypt the cipher using a PHP function, or maybe an online tool like: http://aesencryption.net/

The problem is that they are expecting a key , not a passphrase.

How can I provide the key directly for CryptoJS AES, which can I use on the server side or in any online decryption tool?

, PHP- AES- , /

+4
1

, IV. IV ( ) , XOR'ed 1- . XOR'ed . (CBC).

var key = CryptoJS.enc.Hex.parse('000102030405060708090a0b0c0d0e0f');
var iv  = CryptoJS.enc.Hex.parse('101112131415161718191a1b1c1d1e1f');

var encrypted = CryptoJS.AES.encrypt("Message", key, { iv: iv });

CryptoJS https://code.google.com/p/crypto-js/#Custom_Key_and_IV

IV PBKDF2, @Narf. https://code.google.com/p/crypto-js/#PBKDF2

PHP: mcrypt MCRYPT_RIJNDAEL_128, AES 128. MCRYPT_RIJNDAEL_192 MCRYPT_RIJNDAEL_256 AES 192 AES 256, AES 128- . Rijndael . CryptoJS 128- AES, 128- , 256 , , .

+4

All Articles