openssl使用和问题、踏坑整理

openssl使用问题整理

  • v1.1.1版本之后RSA结构的变化

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,rsa)