libmcrypt usage

From: Date: Wed, 15 Sep 2010 07:59:35 +0000
Subject: libmcrypt usage
Groups: php.general 
Request: Send a blank email to php-general+get-308085@lists.php.net to get a copy of this message
Can anyone tell me what the equivalent to the following command line usage of openssl is, in php using the mcrypt_* functions, please: ,---- | openssl enc -e -aes-256-cbc -k <some key> ... `---- TIA. I tried ,---- | $iv = mcrypt_create_iv(mcrypt_get_block_size(MCRYPT_RIJNDAEL_256, | MCRYPT_MODE_CBC), | MCRYPT_DEV_RANDOM); | $encryptedData = mcrypt_cbc(MCRYPT_RIJNDAEL_256 | ,$passphrase | ,$data | ,MCRYPT_ENCRYPT | ,$iv); `---- amongst other things, but it doesn't work, I get "bad magic number" when I tried to decrypt the contents of $encryptedData using ,---- | openssl enc -d -aes-256-cbc -k <passphrase> ... `---- Yeah, bad magic number, naughty magic number, go and stand in the corner. Seriously. WTH is that supposed to mean?! I also tried not using an iv but mcrypt slapped my wrist for trying it. -- Gary Please do NOT send me 'courtesy' replies off-list. PHP 5.2.12 (cli) (built: Jan 14 2010 14:54:11) 1.7.7(0.230/5/3) 2010-08-31 09:58 Cygwin

« previous php.general (#308085) next »