PHP的:mcrypt的OpenSSL等效:MCRYPT_3DES? [英] PHP : OpenSSL equivilent of mcrypt : MCRYPT_3DES?

查看:98
本文介绍了PHP的:mcrypt的OpenSSL等效:MCRYPT_3DES?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想将对mcrypt的使用转换为openssl.

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

这是我们的加密功能:

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

这是我们的解密功能:

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

以上的openssl_ *等效项是什么?

What are the openssl_* equivalents of the above?

谢谢.

推荐答案

我认为您正在寻找以EVP_des_ede3作为密码的EVP_Encrypt...函数(尽管您实际上应该使用CBC模式而不是ECB).

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 #

如果有帮助,我在 https://github.com上有一个用C ++编写的AES简短示例. /shanet/Crypto-Example .将其转换为使用三重DES应该很简单.

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.

这篇关于PHP的:mcrypt的OpenSSL等效:MCRYPT_3DES?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆