openssl_cipher_iv_length解决方法

时间:2016-01-22 15:28:54

标签: encryption openssl php-5.3

我需要在PHP版本5.3上实现openssl_cipher_iv_length()功能,但不支持此功能。

是否有人能够使用PHP 5.3友好功能解释我能做到这一点的方式?

1 个答案:

答案 0 :(得分:1)

(假设您总是使用评论中所写的AES)

对于大多数常见的AES密码模式(CBC,CFB,ECB,OFB),无论密钥长度如何(密码方法名称中的128/192/256数字),IV长度应为128位= 16字节

openssl_cipher_iv_length()函数返回IV长度in bytes时,您的实现应返回16的常量值。

祝你好运!