set_include_path('./phpseclib0.2.1a'); //http://phpseclib.sourceforge.net/ include('Crypt/AES.php'); $plaintext = 'PLAINTEXT'; $aes = new Crypt_AES(CRYPT_AES_MODE_CBC); $aes->setKey('1234123412341234'); $ciphertext = $aes->encrypt($plaintext); $fp = fopen("ciphertextAES", "wb"); fwrite($fp, $ciphertext); fclose($fp); --------------------------- openssl enc -aes-128-cbc -d -in ciphertextAES -out plaintext.txt -pass pass:1234123412341234 -nosalt bad decrypt ????????????????????????? 3840:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:.\crypto\evp\evp_enc.c:466:
Asked
Active
Viewed 1,674 times
0

prodiv123
- 11
- 1
-
2Is there a question that comes with that piece of code? What are you trying to do? Please be more descriptive so we can help you. – Andre Jan 06 '11 at 16:52
1 Answers
1
openssl enc -aes-128-cbc -e -in plaintext.txt -out ciphertext -nosalt -K AA
-iv AA -p
-p
shows you the key and IV being used:
key=AA000000000000000000000000000000
iv =AA000000000000000000000000000000
Omit the -K
and the -iv
parameters and use -pass
, instead, and you'll see that the password and the key are not at all the same thing. This is true regardless of whether or not the -nosalt
option is used.

Pops
- 30,199
- 37
- 136
- 151