PEM文件格式在哪里指定? [英] Where is the PEM file format specified?

查看:534
本文介绍了PEM文件格式在哪里指定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解析.PEM文件。

我知道在RFC 1421-24中定义了隐私增强型电子邮件的标准。但是他们似乎没有提到我在OpenSSL .pem文件中找到的一些文本(例如键属性,BEGIN CERTIFICATE等)
这是OpenSSL特定的格式吗?

I need to parse .PEM files.
I know that the standard for "Privacy-enhanced Electronic Mail" is defined in RFCs 1421-24. But they don't seem to mention some text I find inside OpenSSL .pem files (eg. "Key Attributes", "BEGIN CERTIFICATE", etc...) Is this an OpenSSL-specific format?

推荐答案

查看现有实现并查看它们的作用通常是有益的。 OpenSSL的/ LibreSSL定义这些BEGIN和的 crypto / pem / pem.h 。例如,目前LibreSSL有以下几点:

It's often beneficial to look at an existing implementation and see what they do. OpenSSL/LibreSSL defines these BEGIN and END markers in crypto/pem/pem.h. For example, the current LibreSSL has the following:

#define PEM_STRING_X509_OLD "X509 CERTIFICATE"
#define PEM_STRING_X509     "CERTIFICATE"
#define PEM_STRING_X509_PAIR    "CERTIFICATE PAIR"
#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST"
#define PEM_STRING_X509_CRL "X509 CRL"
#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY"
#define PEM_STRING_PUBLIC   "PUBLIC KEY"
#define PEM_STRING_RSA      "RSA PRIVATE KEY"
#define PEM_STRING_RSA_PUBLIC   "RSA PUBLIC KEY"
#define PEM_STRING_DSA      "DSA PRIVATE KEY"
#define PEM_STRING_DSA_PUBLIC   "DSA PUBLIC KEY"
#define PEM_STRING_PKCS7    "PKCS7"
#define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA"
#define PEM_STRING_PKCS8    "ENCRYPTED PRIVATE KEY"
#define PEM_STRING_PKCS8INF "PRIVATE KEY"
#define PEM_STRING_DHPARAMS "DH PARAMETERS"
#define PEM_STRING_SSL_SESSION  "SSL SESSION PARAMETERS"
#define PEM_STRING_DSAPARAMS    "DSA PARAMETERS"
#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
#define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
#define PEM_STRING_PARAMETERS   "PARAMETERS"
#define PEM_STRING_CMS      "CMS"

而据我所知,没有BEGIN / END标记的主列表。它们基本上是根据实现定义的。然后,如果你想与该实现互操作,你将字符串添加到自己的。

And as far as I know, there is no master list of BEGIN/END markers. They're pretty much defined on an as-needed basis by an implementation. And then if you want to inter-op with that implementation, you add the string to your own.

这篇关于PEM文件格式在哪里指定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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