openssl使用问题整理
v1.1.1版本之后RSA结构的变化
代码从1.0.2转到openssl 3.0编译时报错:
error: dereferencing pointer to incomplete type ‘RSA’ {aka ‘struct rsa_st’}
不能通过RSA *rsa;
rsa->n去访问内部成员了。
在1.1.1之后,OpenSSL支持getter这样返回每个参数。
const BIGNUM *RSA_get0_n(const RSA *d);
const BIGNUM *RSA_get0_e(const RSA *d);
const BIGNUM *RSA_get0_d(const RSA *d);
const BIGNUM *RSA_get0_p(const RSA *d);
const BIGNUM *RSA_get0_q(const RSA *d);
const BIGNUM *RSA_get0_dmp1(const RSA *r);
const BIGNUM *RSA_get0_dmq1(const RSA *r);
const BIGNUM *RSA_get0_iqmp(const RSA *r);
#The RSA_size() and RSA_security_bits() functions were deprecated in OpenSSL 3.0.
https://blog.csdn.net/liao20081228/article/details/76285896
本文解析了OpenSSL版本1.1.1之后RSA结构的重大变更,详细介绍了从1.0.2版本迁移至3.0版本时遇到的编译错误原因及解决办法。文中提供了新的API调用方式,如使用getter函数访问RSA结构的各个参数,以及说明了被弃用的函数。
2万+

被折叠的 条评论
为什么被折叠?



