RSA私钥的PKCS#1和PKCS#8格式 [英] PKCS#1 and PKCS#8 format for RSA private key

查看:923
本文介绍了RSA私钥的PKCS#1和PKCS#8格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我了解RSA密钥是如何以这些格式存储的吗?我想知道PKCS格式与Encodings(DER,PEM)之间的区别.据我了解,PEM更具人类可读性.密钥/证书的PEM/DER是否类似于UTF-8/16的字符? DER/PEM的意义是什么?抱歉,问题太多了,但厌倦了谷歌搜索和模糊的答案.谢谢.

Can some one help me understand how an RSA key literally is stored in these formats? I would like to know the difference between the PKCS formats vs Encodings(DER, PEM). From what I understand PEM is more human readable. Is PEM/DER for keys/certs similar to UTF-8/16 for characters? What is the significance of DER/PEM? Sorry too many questions but fed up googling and getting vague answers. Thanks.

推荐答案

PKCS#1和PKCS#8(公钥密码标准)是管理特定密码原语,填充等用途的标准.两者均定义文件格式用于存储密钥,证书和其他相关信息.

PKCS#1 and PKCS#8 (Public-Key Cryptography Standard) are standards that govern the use of particular cryptographic primitives, padding, etc. Both define file formats that are used to store keys, certificates, and other relevant information.

PEM和DER更有趣. DER是密钥,证书等的ASN.1编码,您可以在Google上找到很多有关它的信息.私钥和证书使用DER编码,可以像这样直接保存.但是,这些文件是二进制文件,无法轻松复制和粘贴,因此许多(如果不是大多数?)实现也接受PEM编码文件. PEM基本上是base64编码的DER:我们添加标头,可选的元数据和base64编码的DER数据,然后有一个PEM文件.

PEM and DER are a little bit more interesting. DER is the ASN.1 encoding for keys and certificates etc., which you'll be able to Google plenty about. Private keys and certificates are encoded using DER and can be saved directly like this. However, these files are binary and can't be copied and pasted easily, so many (if not most?) implementations accept PEM encoded files also. PEM is basically base64 encoded DER: we add a header, optional meta-data, and the base64 encoded DER data and we have a PEM file.

这篇关于RSA私钥的PKCS#1和PKCS#8格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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