openSSL:PEM_write_RSAPublicKey和PEM_write_RSA_PUBKEY之间的区别 [英] openSSL: difference between PEM_write_RSAPublicKey and PEM_write_RSA_PUBKEY

查看:1130
本文介绍了openSSL:PEM_write_RSAPublicKey和PEM_write_RSA_PUBKEY之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在openssl库中,我可以看到两种将公共密钥写入文件的方法:

In the openssl library I can see two methods to write a public Key to a file:

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

在文档中,我可以看到:

In the documentation i can see:

RSAPublicKey函数使用RSA处理RSA公钥 结构体.使用PKCS#1 RSAPublicKey对公钥进行编码 结构.

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

RSA_PUBKEY函数还使用RSA处理RSA公钥 结构体.但是,公钥使用 SubjectPublicKeyInfo结构,如果公用密钥发生错误 不是RSA

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

这两种方法之间的基本区别是什么!

And what are the fundamentals differences between the 2 methods!

推荐答案

SubjectPublicKeyInfo-用于rfc 3280(Internet X.509公共密钥基础结构)中的公共密钥的ASN1结构.实际上,此格式包含公钥算法的ID和公钥本身.在这种情况下,此公钥是根据pkcs1标准格式化的.因此X.509格式是一种更高级的格式,它不仅描述了RSA公钥,而且还描​​述了一般的公钥.

SubjectPublicKeyInfo - ASN1 structure for public keys which is described in rfc 3280(Internet X.509 Public Key Infrastructure). This format in fact contains id of the public key algorithm and the public key itself. And in this case this public key is formatted according to the pkcs1 standard. So X.509 format is more high level format, it describes not just RSA public key but public key in general.

这篇关于openSSL:PEM_write_RSAPublicKey和PEM_write_RSA_PUBKEY之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆