Greetings.

I'm having some issues understanding Zend\Crypt.
What I'd like is the exact same result when using PHP's mcrypt
extension, what I'm receiving is exact same length strings (64
characters using only Zend\Crypt\Symmetric\Mcrypt, 172 characters using
Zend\Crypt\BlockCipher along with Zend\Crypt\Symmetric\Mcrypt).

When I use PHP's mcrypt with the same configuration I get the first
encryption with 28 characters and the second one with 4 characters. On
both cases (using ZF2 and using mcrypt) I run the encryption through
base64_encode to get the final result.

Please ignore the fact that I'm using the same key for
Zend\Crypt\BlockCipher and Zend\Crypt\Symmetric\Mcrypt, since it's not
the issue (I use it only once when not using BlockCipher and yet get the
"same problematic result").

//Begin code:

//Using ZF2:

$mcrypt  = new Zend\Crypt\Symmetric\Mcrypt();
$mcrypt->setAlgorithm($config['crypto']['algorithm']);
$mcrypt->setKey($config['crypto']['key']);
$mcrypt->setMode($config['crypto']['mode']);
$mcrypt->setSalt($config['crypto']['vector']);

$adapter = new Zend\Crypt\BlockCipher($mcrypt);
$adapter->setKey($config['crypto']['key']);

//Using PHP's Mcrypt:

 $crypt = mcrypt_encrypt($config['crypto']['algorithm'],
$config['crypto']['key'], $data, $config['crypto']['mode'],
$config['crypto']['vector']);

// End code


What am I missing?

-- 
Er Galvão Abbott

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to