pkey的ans1_method字段
EVP_PKEY_ASN1_METHOD,此字段定义了一些ans1结构到pkey内部数据的转换函数
函数放在一个表中,在standard_methods.h中
static const EVP_PKEY_ASN1_METHOD *standard_methods[] = {
#ifndef OPENSSL_NO_RSA
&rsa_asn1_meths[0],
&rsa_asn1_meths[1],
#endif
#ifndef OPENSSL_NO_DH
&dh_asn1_meth,
#endif
#ifndef OPENSSL_NO_DSA
&dsa_asn1_meths[0],
&dsa_asn1_meths[1],
&dsa_asn1_meths[2],
&dsa_asn1_meths[3],
&dsa_asn1_meths[4],
#endif
#ifndef OPENSSL_NO_EC
&eckey_asn1_meth,
#endif
&hmac_asn1_meth,
#ifndef OPENSSL_NO_CMAC
&cmac_asn1_meth,
#endif
#ifndef OPENSSL_NO_RSA
&rsa_pss_asn1_meth,
#endif
#ifndef OPENSSL_NO_DH
&dhx_asn1_meth,
#endif
#ifndef OPENSSL_NO_EC
&ecx25519_asn1_meth,
&ecx448_asn1_meth,
#endif
#ifndef OPENSSL_NO_POLY1305
&poly1305_asn1_meth,
#endif
#ifndef OPENSSL_NO_SIPHASH
&siphash_asn1_meth,
#endif
#ifndef OPENSSL_NO_EC
&ed25519_asn1_meth,
&ed448_asn1_meth,
#endif
#ifndef OPENSSL_NO_SM2
&sm2_asn1_meth,
#endif
};
调用的地方
调用赋值的地方。
EVP_PKEY_assign_RSA
EVP_PKEY_assign
EVP_PKEY_set_type
pkey_set_type
EVP_PKEY_ASN1_METHOD
ameth = EVP_PKEY_asn1_find(eptr, type);
这会就会把ameth赋值给pkey
pkey_asn1_find
比如这里的类型是RSA,那么就找到上面的表中RSA相关的方法
本文介绍了pkey的ans1_method字段,详细解释了EVP_PKEY_ASN1_METHOD的作用及其实现方式,包括不同类型的密钥对应的转换函数及其在标准方法表中的位置。

5266

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



