PHP: OpenSSL equivilent mcrypt: MCRYPT_3DES?

We would like to convert our use of mcrypt to openssl.

Here is our encryption function:

mcrypt_ecb(MCRYPT_3DES,$key,$payload,MCRYPT_ENCRYPT) 

Here is our decryption function:

 mcrypt_ecb(MCRYPT_3DES,$key,$payload,MCRYPT_DECRYPT) 

What are the equivalents of openssl_ * from the above?

Thanks.

+1
php openssl mcrypt 3des
source share
1 answer

I think you are looking for EVP_Encrypt... functions EVP_Encrypt... with EVP_des_ede3 as encryption (although you really should use CBC mode, not ECB).

https://www.openssl.org/docs/crypto/EVP_EncryptInit.html#

If this helps, I have a short example for AES written in C ++ at https://github.com/shanet/Crypto-Example . Converting it to triple DES should be trivial.

0
source share

All Articles