简体   繁体   中英

PHP : OpenSSL equivilent of 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 openssl_* equivalents of the above?

Thanks.

I think you're looking for the EVP_Encrypt... functions with EVP_des_ede3 as the cipher (although you should really be using CBC mode rather than ECB).

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM