[英]EVP_get_cipherbyname always returns null
I have a problem when calling EVP_get_cipherbyname
on macOS: 在macOS上调用EVP_get_cipherbyname
时EVP_get_cipherbyname
问题:
const char *cipher_str = "aes-256-cbc";
const evp_cipher_st *cipher1 = EVP_aes_256_cbc();
const evp_cipher_st *cipher2 = EVP_get_cipherbyname(cipher_str);
In the code above, cipher1
will always be set to a valid evp_cipher_st *
object, and cipher2
will always be null. 在上面的代码中, cipher1
将始终设置为有效的evp_cipher_st *
对象,而cipher2
将始终为null。 I haven't found a single instance of cipher_str
that produces a non-null cipher2
. 我还没有找到产生非null cipher2
的cipher_str
单个实例。
Am I doing something wrong? 难道我做错了什么? Are there some other calls I should be making to get this to work? 为了使它正常工作,我还应该打电话吗?
You need to initialize the OpenSSL library first. 您需要先初始化OpenSSL库。 If you just use libcrypto, call: 如果仅使用libcrypto,请致电:
OpenSSL_add_all_algorithms();
Refer to https://wiki.openssl.org/index.php/Library_Initialization for how to handle other situations or openssl versions. 有关如何处理其他情况或openssl版本的信息,请参阅https://wiki.openssl.org/index.php/Library_Initialization 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.