加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – openSSL:PEM_write_RSAPublicKey和PEM_write_RSA_PUBKEY之

发布时间:2020-12-16 07:34:07 所属栏目:百科 来源:网络整理
导读:在openssl库中,我可以看到两种将公钥写入文件的方法: int PEM_write_RSAPublicKey(FILE *fp,RSA *x);int PEM_write_RSA_PUBKEY(FILE *fp,RSA *x); 在文档中,我可以看到: The RSAPublicKey functions process an RSA public key using an RSA structure. Th
在openssl库中,我可以看到两种将公钥写入文件的方法:

int PEM_write_RSAPublicKey(FILE *fp,RSA *x);
int PEM_write_RSA_PUBKEY(FILE *fp,RSA *x);

在文档中,我可以看到:

The RSAPublicKey functions process an RSA public key using an RSA
structure. The public key is encoded using a PKCS#1 RSAPublicKey
structure.

The RSA_PUBKEY functions also process an RSA public key using an RSA
structure. However the public key is encoded using a
SubjectPublicKeyInfo structure and an error occurs if the public key
is not RSA

但我不明白是什么

SubjectPublicKeyInfo

两种方法之间的基本面差异是什么!

解决方法

SubjectPublicKeyInfo – 公钥的ASN1结构,在rfc 3280(Internet X.509公钥基础结构)中描述.事实上,这种格式包含公钥算法的id和公钥本身.在这种情况下,此公钥是根据pkcs1标准格式化的.所以X.509格式是更高级的格式,它不仅描述了RSA公钥,而且描述了公钥.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读