| 1 |
<pre>Internet Engineering Task Force (IETF) S. Josefsson |
| 2 |
Request for Comments: 7468 SJD AB |
| 3 |
Category: Standards Track S. Leonard |
| 4 |
ISSN: 2070-1721 Penango, Inc. |
| 5 |
April 2015 |
| 6 |
|
| 7 |
|
| 8 |
<span class="h1">Textual Encodings of PKIX, PKCS, and CMS Structures</span> |
| 9 |
|
| 10 |
Abstract |
| 11 |
|
| 12 |
This document describes and discusses the textual encodings of the |
| 13 |
Public-Key Infrastructure X.509 (PKIX), Public-Key Cryptography |
| 14 |
Standards (PKCS), and Cryptographic Message Syntax (CMS). The |
| 15 |
textual encodings are well-known, are implemented by several |
| 16 |
applications and libraries, and are widely deployed. This document |
| 17 |
articulates the de facto rules by which existing implementations |
| 18 |
operate and defines them so that future implementations can |
| 19 |
interoperate. |
| 20 |
|
| 21 |
Status of This Memo |
| 22 |
|
| 23 |
This is an Internet Standards Track document. |
| 24 |
|
| 25 |
This document is a product of the Internet Engineering Task Force |
| 26 |
(IETF). It represents the consensus of the IETF community. It has |
| 27 |
received public review and has been approved for publication by the |
| 28 |
Internet Engineering Steering Group (IESG). Further information on |
| 29 |
Internet Standards is available in <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>. |
| 30 |
|
| 31 |
Information about the current status of this document, any errata, |
| 32 |
and how to provide feedback on it may be obtained at |
| 33 |
<a href="http://www.rfc-editor.org/info/rfc7468">http://www.rfc-editor.org/info/rfc7468</a>. |
| 34 |
|
| 35 |
Copyright Notice |
| 36 |
|
| 37 |
Copyright (c) 2015 IETF Trust and the persons identified as the |
| 38 |
document authors. All rights reserved. |
| 39 |
|
| 40 |
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal |
| 41 |
Provisions Relating to IETF Documents |
| 42 |
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of |
| 43 |
publication of this document. Please review these documents |
| 44 |
carefully, as they describe your rights and restrictions with respect |
| 45 |
to this document. Code Components extracted from this document must |
| 46 |
include Simplified BSD License text as described in Section 4.e of |
| 47 |
the Trust Legal Provisions and are provided without warranty as |
| 48 |
described in the Simplified BSD License. |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<span class="grey">Josefsson & Leonard Standards Track [Page 1]</span></pre> |
| 53 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span> |
| 54 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 55 |
|
| 56 |
|
| 57 |
Table of Contents |
| 58 |
|
| 59 |
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a> |
| 60 |
<a href="#section-2">2</a>. General Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a> |
| 61 |
<a href="#section-3">3</a>. ABNF . . . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a> |
| 62 |
<a href="#section-4">4</a>. Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-7">7</a> |
| 63 |
<a href="#section-5">5</a>. Textual Encoding of Certificates . . . . . . . . . . . . . . <a href="#page-8">8</a> |
| 64 |
<a href="#section-5.1">5.1</a>. Encoding . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-8">8</a> |
| 65 |
<a href="#section-5.2">5.2</a>. Explanatory Text . . . . . . . . . . . . . . . . . . . . <a href="#page-9">9</a> |
| 66 |
<a href="#section-5.3">5.3</a>. File Extension . . . . . . . . . . . . . . . . . . . . . <a href="#page-9">9</a> |
| 67 |
<a href="#section-6">6</a>. Textual Encoding of Certificate Revocation Lists . . . . . . <a href="#page-10">10</a> |
| 68 |
<a href="#section-7">7</a>. Textual Encoding of PKCS #10 Certification Request Syntax . . <a href="#page-11">11</a> |
| 69 |
<a href="#section-8">8</a>. Textual Encoding of PKCS #7 Cryptographic Message Syntax . . <a href="#page-11">11</a> |
| 70 |
<a href="#section-9">9</a>. Textual Encoding of Cryptographic Message Syntax . . . . . . <a href="#page-12">12</a> |
| 71 |
10. One Asymmetric Key and the Textual Encoding of PKCS #8 |
| 72 |
Private Key Info . . . . . . . . . . . . . . . . . . . . . . <a href="#page-12">12</a> |
| 73 |
<a href="#section-11">11</a>. Textual Encoding of PKCS #8 Encrypted Private Key Info . . . <a href="#page-13">13</a> |
| 74 |
<a href="#section-12">12</a>. Textual Encoding of Attribute Certificates . . . . . . . . . <a href="#page-13">13</a> |
| 75 |
<a href="#section-13">13</a>. Textual Encoding of Subject Public Key Info . . . . . . . . . <a href="#page-14">14</a> |
| 76 |
<a href="#section-14">14</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a> |
| 77 |
<a href="#section-15">15</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a> |
| 78 |
<a href="#section-15.1">15.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a> |
| 79 |
<a href="#section-15.2">15.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-15">15</a> |
| 80 |
<a href="#appendix-A">Appendix A</a>. Non-conforming Examples . . . . . . . . . . . . . . <a href="#page-17">17</a> |
| 81 |
<a href="#appendix-B">Appendix B</a>. DER Expectations . . . . . . . . . . . . . . . . . . <a href="#page-18">18</a> |
| 82 |
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-19">19</a> |
| 83 |
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a> |
| 84 |
|
| 85 |
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span> |
| 86 |
|
| 87 |
Several security-related standards used on the Internet define ASN.1 |
| 88 |
data formats that are normally encoded using the Basic Encoding Rules |
| 89 |
(BER) or Distinguished Encoding Rules (DER) [<a href="#ref-X.690" title=""Information Technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)"">X.690</a>], which are |
| 90 |
binary, octet-oriented encodings. This document is about the textual |
| 91 |
encodings of the following formats: |
| 92 |
|
| 93 |
1. Certificates, Certificate Revocation Lists (CRLs), and Subject |
| 94 |
Public Key Info structures in the Internet X.509 Public Key |
| 95 |
Infrastructure Certificate and Certificate Revocation List (CRL) |
| 96 |
Profile [<a href="./rfc5280" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">RFC5280</a>]. |
| 97 |
|
| 98 |
2. PKCS #10: Certification Request Syntax [<a href="./rfc2986" title=""PKCS #10: Certification Request Syntax Specification Version 1.7"">RFC2986</a>]. |
| 99 |
|
| 100 |
3. PKCS #7: Cryptographic Message Syntax [<a href="./rfc2315" title=""PKCS #7: Cryptographic Message Syntax Version 1.5"">RFC2315</a>]. |
| 101 |
|
| 102 |
4. Cryptographic Message Syntax [<a href="./rfc5652" title=""Cryptographic Message Syntax (CMS)"">RFC5652</a>]. |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
<span class="grey">Josefsson & Leonard Standards Track [Page 2]</span></pre> |
| 109 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span> |
| 110 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 111 |
|
| 112 |
|
| 113 |
5. PKCS #8: Private-Key Information Syntax [<a href="./rfc5208" title=""Public-Key Cryptography Standards (PKCS) #8: Private-Key Information Syntax Specification Version 1.2"">RFC5208</a>], renamed to One |
| 114 |
Asymmetric Key in Asymmetric Key Package [<a href="./rfc5958" title=""Asymmetric Key Packages"">RFC5958</a>], and Encrypted |
| 115 |
Private-Key Information Syntax in the same documents. |
| 116 |
|
| 117 |
6. Attribute Certificates in An Internet Attribute Certificate |
| 118 |
Profile for Authorization [<a href="./rfc5755" title=""An Internet Attribute Certificate Profile for Authorization"">RFC5755</a>]. |
| 119 |
|
| 120 |
A disadvantage of a binary data format is that it cannot be |
| 121 |
interchanged in textual transports, such as email or text documents. |
| 122 |
One advantage with text-based encodings is that they are easy to |
| 123 |
modify using common text editors; for example, a user may concatenate |
| 124 |
several certificates to form a certificate chain with copy-and-paste |
| 125 |
operations. |
| 126 |
|
| 127 |
The tradition within the RFC series can be traced back to Privacy- |
| 128 |
Enhanced Mail (PEM) [<a href="./rfc1421" title=""Privacy Enhancement for Internet Electronic Mail: Part I: Message Encryption and Authentication Procedures"">RFC1421</a>], based on a proposal by Marshall Rose |
| 129 |
in Message Encapsulation [<a href="./rfc934" title=""Proposed standard for message encapsulation"">RFC934</a>]. Originally called "PEM |
| 130 |
encapsulation mechanism", "encapsulated PEM message", or (arguably) |
| 131 |
"PEM printable encoding", today the format is sometimes referred to |
| 132 |
as "PEM encoding". Variations include OpenPGP ASCII armor [<a href="./rfc4880" title=""OpenPGP Message Format"">RFC4880</a>] |
| 133 |
and OpenSSH key file format [<a href="./rfc4716" title=""The Secure Shell (SSH) Public Key File Format"">RFC4716</a>]. |
| 134 |
|
| 135 |
For reasons that basically boil down to non-coordination or |
| 136 |
inattention, many PKIX, PKCS, and CMS libraries implement a text- |
| 137 |
based encoding that is similar to -- but not identical with -- PEM |
| 138 |
encoding. This document specifies the _textual encoding_ format, |
| 139 |
articulates the de facto rules that most implementations operate by, |
| 140 |
and provides recommendations that will promote interoperability going |
| 141 |
forward. This document also provides common nomenclature for syntax |
| 142 |
elements, reflecting the evolution of this de facto standard format. |
| 143 |
Peter Gutmann's "X.509 Style Guide" [<a href="#ref-X.509SG" title=""X.509 Style Guide"">X.509SG</a>] contains a section |
| 144 |
"base64 Encoding" that describes the formats and contains suggestions |
| 145 |
similar to what is in this document. All figures are real, |
| 146 |
functional examples, with key lengths and inner contents chosen to be |
| 147 |
as small as practicable. |
| 148 |
|
| 149 |
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
| 150 |
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and |
| 151 |
"OPTIONAL" in this document are to be interpreted as described in <a href="./rfc2119">RFC</a> |
| 152 |
<a href="./rfc2119">2119</a> [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>]. |
| 153 |
|
| 154 |
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. General Considerations</span> |
| 155 |
|
| 156 |
Textual encoding begins with a line comprising "-----BEGIN ", a |
| 157 |
label, and "-----", and ends with a line comprising "-----END ", a |
| 158 |
label, and "-----". Between these lines, or "encapsulation |
| 159 |
boundaries", are base64-encoded data according to <a href="./rfc4648#section-4">Section 4 of |
| 160 |
[RFC4648]</a>. (PEM [<a href="./rfc1421" title=""Privacy Enhancement for Internet Electronic Mail: Part I: Message Encryption and Authentication Procedures"">RFC1421</a>] referred to this data as the "encapsulated |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<span class="grey">Josefsson & Leonard Standards Track [Page 3]</span></pre> |
| 165 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span> |
| 166 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 167 |
|
| 168 |
|
| 169 |
text portion".) Data before the encapsulation boundaries are |
| 170 |
permitted, and parsers MUST NOT malfunction when processing such |
| 171 |
data. Furthermore, parsers SHOULD ignore whitespace and other non- |
| 172 |
base64 characters and MUST handle different newline conventions. |
| 173 |
|
| 174 |
The type of data encoded is labeled depending on the type label in |
| 175 |
the "-----BEGIN " line (pre-encapsulation boundary). For example, |
| 176 |
the line may be "-----BEGIN CERTIFICATE-----" to indicate that the |
| 177 |
content is a PKIX certificate (see further below). Generators MUST |
| 178 |
put the same label on the "-----END " line (post-encapsulation |
| 179 |
boundary) as the corresponding "-----BEGIN " line. Labels are |
| 180 |
formally case-sensitive, uppercase, and comprised of zero or more |
| 181 |
characters; they do not contain consecutive spaces or hyphen-minuses, |
| 182 |
nor do they contain spaces or hyphen-minuses at either end. Parsers |
| 183 |
MAY disregard the label in the post-encapsulation boundary instead of |
| 184 |
signaling an error if there is a label mismatch: some extant |
| 185 |
implementations require the labels to match; others do not. |
| 186 |
|
| 187 |
There is exactly one space character (SP) separating the "BEGIN" or |
| 188 |
"END" from the label. There are exactly five hyphen-minus (also |
| 189 |
known as dash) characters ("-") on both ends of the encapsulation |
| 190 |
boundaries, no more, no less. |
| 191 |
|
| 192 |
The label type implies that the encoded data follows the specified |
| 193 |
syntax. Parsers MUST handle non-conforming data gracefully. |
| 194 |
However, not all parsers or generators prior to this document behave |
| 195 |
consistently. A conforming parser MAY interpret the contents as |
| 196 |
another label type but ought to be aware of the security implications |
| 197 |
discussed in the Security Considerations section. The labels |
| 198 |
described in this document identify container formats that are not |
| 199 |
specific to any particular cryptographic algorithm, a property |
| 200 |
consistent with algorithm agility. These formats use the ASN.1 |
| 201 |
AlgorithmIdentifier structure as described in <a href="./rfc5280#section-4.1.1.2">Section 4.1.1.2 of |
| 202 |
[RFC5280]</a>. |
| 203 |
|
| 204 |
Unlike legacy PEM encoding [<a href="./rfc1421" title=""Privacy Enhancement for Internet Electronic Mail: Part I: Message Encryption and Authentication Procedures"">RFC1421</a>], OpenPGP ASCII armor, and the |
| 205 |
OpenSSH key file format, textual encoding does *not* define or permit |
| 206 |
headers to be encoded alongside the data. Empty space can appear |
| 207 |
between the pre-encapsulation boundary and the base64, but generators |
| 208 |
SHOULD NOT emit such any such spacing. (The provision for this empty |
| 209 |
area is a throwback to PEM, which defined an "encapsulated header |
| 210 |
portion".) |
| 211 |
|
| 212 |
Implementers need to be aware that extant parsers diverge |
| 213 |
considerably on the handling of whitespace. In this document, |
| 214 |
"whitespace" means any character or series of characters that |
| 215 |
represent horizontal or vertical space in typography. In US-ASCII, |
| 216 |
whitespace means HT (0x09), VT (0x0B), FF (0x0C), SP (0x20), CR |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
<span class="grey">Josefsson & Leonard Standards Track [Page 4]</span></pre> |
| 221 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span> |
| 222 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 223 |
|
| 224 |
|
| 225 |
(0x0D), and LF (0x0A); "blank" means HT and SP; lines are divided |
| 226 |
with CRLF, CR, or LF. The common ABNF production WSP is congruent |
| 227 |
with "blank"; a new production W is used for "whitespace". The ABNF |
| 228 |
in <a href="#section-3">Section 3</a> is specific to US-ASCII. As these textual encodings can |
| 229 |
be used on many different systems as well as on long-term archival |
| 230 |
storage media such as paper or engravings, an implementer ought to |
| 231 |
use the spirit rather than the letter of the rules when generating or |
| 232 |
parsing these formats in environments that are not strictly limited |
| 233 |
to US-ASCII. |
| 234 |
|
| 235 |
Most extant parsers ignore blanks at the ends of lines; blanks at the |
| 236 |
beginnings of lines or in the middle of the base64-encoded data are |
| 237 |
far less compatible. These observations are codified in Figure 1. |
| 238 |
The most lax parser implementations are not line-oriented at all and |
| 239 |
will accept any mixture of whitespace outside of the encapsulation |
| 240 |
boundaries (see Figure 2). Such lax parsing may run the risk of |
| 241 |
accepting text that was not intended to be accepted in the first |
| 242 |
place (e.g., because the text was a snippet or sample). |
| 243 |
|
| 244 |
Generators MUST wrap the base64-encoded lines so that each line |
| 245 |
consists of exactly 64 characters except for the final line, which |
| 246 |
will encode the remainder of the data (within the 64-character line |
| 247 |
boundary), and they MUST NOT emit extraneous whitespace. Parsers MAY |
| 248 |
handle other line sizes. These requirements are consistent with PEM |
| 249 |
[<a href="./rfc1421" title=""Privacy Enhancement for Internet Electronic Mail: Part I: Message Encryption and Authentication Procedures"">RFC1421</a>]. |
| 250 |
|
| 251 |
Files MAY contain multiple textual encoding instances. This is used, |
| 252 |
for example, when a file contains several certificates. Whether the |
| 253 |
instances are ordered or unordered depends on the context. |
| 254 |
|
| 255 |
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. ABNF</span> |
| 256 |
|
| 257 |
The ABNF [<a href="./rfc5234" title=""Augmented BNF for Syntax Specifications: ABNF"">RFC5234</a>] of the textual encoding is: |
| 258 |
|
| 259 |
textualmsg = preeb *WSP eol |
| 260 |
*eolWSP |
| 261 |
base64text |
| 262 |
posteb *WSP [eol] |
| 263 |
|
| 264 |
preeb = "-----BEGIN " label "-----" ; unlike [<a href="./rfc1421" title=""Privacy Enhancement for Internet Electronic Mail: Part I: Message Encryption and Authentication Procedures"">RFC1421</a>] (A)BNF, |
| 265 |
; eol is not required (but |
| 266 |
posteb = "-----END " label "-----" ; see <a href="./rfc1421#section-4.4">[RFC1421], Section 4.4</a>) |
| 267 |
|
| 268 |
base64char = ALPHA / DIGIT / "+" / "/" |
| 269 |
|
| 270 |
base64pad = "=" |
| 271 |
|
| 272 |
base64line = 1*base64char *WSP eol |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
<span class="grey">Josefsson & Leonard Standards Track [Page 5]</span></pre> |
| 277 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span> |
| 278 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 279 |
|
| 280 |
|
| 281 |
base64finl = *base64char (base64pad *WSP eol base64pad / |
| 282 |
*2base64pad) *WSP eol |
| 283 |
; ...AB= <EOL> = <EOL> is not good, but is valid |
| 284 |
|
| 285 |
base64text = *base64line base64finl |
| 286 |
; we could also use <encbinbody> from <a href="./rfc1421">RFC 1421</a>, which requires |
| 287 |
; 16 groups of 4 chars, which means exactly 64 chars per |
| 288 |
; line, except the final line, but this is more accurate |
| 289 |
|
| 290 |
labelchar = %x21-2C / %x2E-7E ; any printable character, |
| 291 |
; except hyphen-minus |
| 292 |
|
| 293 |
label = [ labelchar *( ["-" / SP] labelchar ) ] ; empty ok |
| 294 |
|
| 295 |
eol = CRLF / CR / LF |
| 296 |
|
| 297 |
eolWSP = WSP / CR / LF ; compare with LWSP |
| 298 |
|
| 299 |
Figure 1: ABNF (Standard) |
| 300 |
|
| 301 |
laxtextualmsg = *W preeb |
| 302 |
laxbase64text |
| 303 |
posteb *W |
| 304 |
|
| 305 |
W = WSP / CR / LF / %x0B / %x0C ; whitespace |
| 306 |
|
| 307 |
laxbase64text = *(W / base64char) [base64pad *W [base64pad *W]] |
| 308 |
|
| 309 |
Figure 2: ABNF (Lax) |
| 310 |
|
| 311 |
stricttextualmsg = preeb eol |
| 312 |
strictbase64text |
| 313 |
posteb eol |
| 314 |
|
| 315 |
strictbase64finl = *15(4base64char) (4base64char / 3base64char |
| 316 |
base64pad / 2base64char 2base64pad) eol |
| 317 |
|
| 318 |
base64fullline = 64base64char eol |
| 319 |
|
| 320 |
strictbase64text = *base64fullline strictbase64finl |
| 321 |
|
| 322 |
Figure 3: ABNF (Strict) |
| 323 |
|
| 324 |
New implementations SHOULD emit the strict format (Figure 3) |
| 325 |
specified above. The choice of parsing strategy depends on the |
| 326 |
context of use. |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
<span class="grey">Josefsson & Leonard Standards Track [Page 6]</span></pre> |
| 333 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span> |
| 334 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 335 |
|
| 336 |
|
| 337 |
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Guide</span> |
| 338 |
|
| 339 |
For convenience, these figures summarize the structures, encodings, |
| 340 |
and references in the following sections: |
| 341 |
|
| 342 |
Sec. Label ASN.1 Type Reference Module |
| 343 |
----+----------------------+-----------------------+---------+---------- |
| 344 |
5 CERTIFICATE Certificate [<a href="./rfc5280" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">RFC5280</a>] id-pkix1-e |
| 345 |
6 X509 CRL CertificateList [<a href="./rfc5280" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">RFC5280</a>] id-pkix1-e |
| 346 |
7 CERTIFICATE REQUEST CertificationRequest [<a href="./rfc2986" title=""PKCS #10: Certification Request Syntax Specification Version 1.7"">RFC2986</a>] id-pkcs10 |
| 347 |
8 PKCS7 ContentInfo [<a href="./rfc2315" title=""PKCS #7: Cryptographic Message Syntax Version 1.5"">RFC2315</a>] id-pkcs7* |
| 348 |
9 CMS ContentInfo [<a href="./rfc5652" title=""Cryptographic Message Syntax (CMS)"">RFC5652</a>] id-cms2004 |
| 349 |
10 PRIVATE KEY PrivateKeyInfo ::= [<a href="./rfc5208" title=""Public-Key Cryptography Standards (PKCS) #8: Private-Key Information Syntax Specification Version 1.2"">RFC5208</a>] id-pkcs8 |
| 350 |
OneAsymmetricKey [<a href="./rfc5958" title=""Asymmetric Key Packages"">RFC5958</a>] id-aKPV1 |
| 351 |
11 ENCRYPTED PRIVATE KEY EncryptedPrivateKeyInfo [<a href="./rfc5958" title=""Asymmetric Key Packages"">RFC5958</a>] id-aKPV1 |
| 352 |
12 ATTRIBUTE CERTIFICATE AttributeCertificate [<a href="./rfc5755" title=""An Internet Attribute Certificate Profile for Authorization"">RFC5755</a>] id-acv2 |
| 353 |
13 PUBLIC KEY SubjectPublicKeyInfo [<a href="./rfc5280" title=""Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile"">RFC5280</a>] id-pkix1-e |
| 354 |
|
| 355 |
Figure 4: Convenience Guide |
| 356 |
|
| 357 |
----------------------------------------------------------------------- |
| 358 |
id-pkixmod OBJECT IDENTIFIER ::= {iso(1) identified-organization(3) |
| 359 |
dod(6) internet(1) security(5) mechanisms(5) pkix(7) mod(0)} |
| 360 |
id-pkix1-e OBJECT IDENTIFIER ::= {id-pkixmod pkix1-explicit(18)} |
| 361 |
id-acv2 OBJECT IDENTIFIER ::= {id-pkixmod mod-attribute-cert-v2(61)} |
| 362 |
id-pkcs OBJECT IDENTIFIER ::= {iso(1) member-body(2) us(840) |
| 363 |
rsadsi(113549) pkcs(1)} |
| 364 |
id-pkcs10 OBJECT IDENTIFIER ::= {id-pkcs 10 modules(1) pkcs-10(1)} |
| 365 |
id-pkcs7 OBJECT IDENTIFIER ::= {id-pkcs 7 modules(0) pkcs-7(1)} |
| 366 |
id-pkcs8 OBJECT IDENTIFIER ::= {id-pkcs 8 modules(1) pkcs-8(1)} |
| 367 |
id-sm-mod OBJECT IDENTIFIER ::= {id-pkcs 9 smime(16) modules(0)} |
| 368 |
id-aKPV1 OBJECT IDENTIFIER ::= {id-sm-mod mod-asymmetricKeyPkgV1(50)} |
| 369 |
id-cms2004 OBJECT IDENTIFIER ::= {id-sm-mod cms-2004(24)} |
| 370 |
|
| 371 |
* This OID does not actually appear in PKCS #7 v1.5 [<a href="./rfc2315" title=""PKCS #7: Cryptographic Message Syntax Version 1.5"">RFC2315</a>]. It |
| 372 |
was defined in the ASN.1 module to PKCS #7 v1.6 [<a href="#ref-P7v1.6" title=""Extensions and Revisions to PKCS #7 (Version 1.6 Bulletin)"">P7v1.6</a>], and has |
| 373 |
been carried forward through PKCS #12 [<a href="./rfc7292" title=""PKCS #12: Personal Information Exchange Syntax v1.1"">RFC7292</a>]. |
| 374 |
|
| 375 |
Figure 5: ASN.1 Module Object Identifier Value Assignments |
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
<span class="grey">Josefsson & Leonard Standards Track [Page 7]</span></pre> |
| 389 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span> |
| 390 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 391 |
|
| 392 |
|
| 393 |
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Textual Encoding of Certificates</span> |
| 394 |
|
| 395 |
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Encoding</span> |
| 396 |
|
| 397 |
Public-key certificates are encoded using the "CERTIFICATE" label. |
| 398 |
The encoded data MUST be a BER (DER strongly preferred; see |
| 399 |
<a href="#appendix-B">Appendix B</a>) encoded ASN.1 Certificate structure as described in |
| 400 |
<a href="./rfc5280#section-4">Section 4 of [RFC5280]</a>. |
| 401 |
|
| 402 |
-----BEGIN CERTIFICATE----- |
| 403 |
MIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0G |
| 404 |
A1UEChMGR251VExTMSUwIwYDVQQLExxHbnVUTFMgY2VydGlmaWNhdGUgYXV0aG9y |
| 405 |
aXR5MQ8wDQYDVQQIEwZMZXV2ZW4xJTAjBgNVBAMTHEdudVRMUyBjZXJ0aWZpY2F0 |
| 406 |
ZSBhdXRob3JpdHkwHhcNMTEwNTIzMjAzODIxWhcNMTIxMjIyMDc0MTUxWjB9MQsw |
| 407 |
CQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQLExxHbnVUTFMgY2Vy |
| 408 |
dGlmaWNhdGUgYXV0aG9yaXR5MQ8wDQYDVQQIEwZMZXV2ZW4xJTAjBgNVBAMTHEdu |
| 409 |
dVRMUyBjZXJ0aWZpY2F0ZSBhdXRob3JpdHkwWTATBgcqhkjOPQIBBggqhkjOPQMB |
| 410 |
BwNCAARS2I0jiuNn14Y2sSALCX3IybqiIJUvxUpj+oNfzngvj/Niyv2394BWnW4X |
| 411 |
uQ4RTEiywK87WRcWMGgJB5kX/t2no0MwQTAPBgNVHRMBAf8EBTADAQH/MA8GA1Ud |
| 412 |
DwEB/wQFAwMHBgAwHQYDVR0OBBYEFPC0gf6YEr+1KLlkQAPLzB9mTigDMAoGCCqG |
| 413 |
SM49BAMCA0gAMEUCIDGuwD1KPyG+hRf88MeyMQcqOFZD0TbVleF+UsAGQ4enAiEA |
| 414 |
l4wOuDwKQa+upc8GftXE2C//4mKANBC6It01gUaTIpo= |
| 415 |
-----END CERTIFICATE----- |
| 416 |
|
| 417 |
Figure 6: Certificate Example |
| 418 |
|
| 419 |
Historically, the label "X509 CERTIFICATE" and also less commonly |
| 420 |
"X.509 CERTIFICATE" have been used. Generators conforming to this |
| 421 |
document MUST generate "CERTIFICATE" labels and MUST NOT generate |
| 422 |
"X509 CERTIFICATE" or "X.509 CERTIFICATE" labels. Parsers SHOULD NOT |
| 423 |
treat "X509 CERTIFICATE" or "X.509 CERTIFICATE" as equivalent to |
| 424 |
"CERTIFICATE", but a valid exception may be for backwards |
| 425 |
compatibility (potentially together with a warning). |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
<span class="grey">Josefsson & Leonard Standards Track [Page 8]</span></pre> |
| 445 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span> |
| 446 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 447 |
|
| 448 |
|
| 449 |
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Explanatory Text</span> |
| 450 |
|
| 451 |
Many tools are known to emit explanatory text before the BEGIN and |
| 452 |
after the END lines for PKIX certificates, more than any other type. |
| 453 |
If emitted, such text SHOULD be related to the certificate, such as |
| 454 |
providing a textual representation of key data elements in the |
| 455 |
certificate. |
| 456 |
|
| 457 |
Subject: CN=Atlantis |
| 458 |
Issuer: CN=Atlantis |
| 459 |
Validity: from 7/9/2012 3:10:38 AM UTC to 7/9/2013 3:10:37 AM UTC |
| 460 |
-----BEGIN CERTIFICATE----- |
| 461 |
MIIBmTCCAUegAwIBAgIBKjAJBgUrDgMCHQUAMBMxETAPBgNVBAMTCEF0bGFudGlz |
| 462 |
MB4XDTEyMDcwOTAzMTAzOFoXDTEzMDcwOTAzMTAzN1owEzERMA8GA1UEAxMIQXRs |
| 463 |
YW50aXMwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAu+BXo+miabDIHHx+yquqzqNh |
| 464 |
Ryn/XtkJIIHVcYtHvIX+S1x5ErgMoHehycpoxbErZmVR4GCq1S2diNmRFZCRtQID |
| 465 |
AQABo4GJMIGGMAwGA1UdEwEB/wQCMAAwIAYDVR0EAQH/BBYwFDAOMAwGCisGAQQB |
| 466 |
gjcCARUDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDAzA1BgNVHQEE |
| 467 |
LjAsgBA0jOnSSuIHYmnVryHAdywMoRUwEzERMA8GA1UEAxMIQXRsYW50aXOCASow |
| 468 |
CQYFKw4DAh0FAANBAKi6HRBaNEL5R0n56nvfclQNaXiDT174uf+lojzA4lhVInc0 |
| 469 |
ILwpnZ1izL4MlI9eCSHhVQBHEp2uQdXJB+d5Byg= |
| 470 |
-----END CERTIFICATE----- |
| 471 |
|
| 472 |
Figure 7: Certificate Example with Explanatory Text |
| 473 |
|
| 474 |
<span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. File Extension</span> |
| 475 |
|
| 476 |
Although textual encodings of PKIX structures can occur anywhere, |
| 477 |
many tools are known to offer an option to output this encoding when |
| 478 |
serializing PKIX structures. To promote interoperability and to |
| 479 |
separate DER encodings from textual encodings, the extension ".crt" |
| 480 |
SHOULD be used for the textual encoding of a certificate. |
| 481 |
Implementations should be aware that in spite of this recommendation, |
| 482 |
many tools still default to encode certificates in this textual |
| 483 |
encoding with the extension ".cer". |
| 484 |
|
| 485 |
This section does not disturb the official application/pkix-cert |
| 486 |
registration [<a href="./rfc2585" title=""Internet X.509 Public Key Infrastructure Operational Protocols: FTP and HTTP"">RFC2585</a>] in any way (which states that "each '.cer' |
| 487 |
file contains exactly one certificate, encoded in DER format"), but |
| 488 |
merely articulates a widespread, de facto alternative. |
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
<span class="grey">Josefsson & Leonard Standards Track [Page 9]</span></pre> |
| 501 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span> |
| 502 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 503 |
|
| 504 |
|
| 505 |
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Textual Encoding of Certificate Revocation Lists</span> |
| 506 |
|
| 507 |
Certificate Revocation Lists (CRLs) are encoded using the "X509 CRL" |
| 508 |
label. The encoded data MUST be a BER (DER strongly preferred; see |
| 509 |
<a href="#appendix-B">Appendix B</a>) encoded ASN.1 CertificateList structure as described in |
| 510 |
<a href="./rfc5280#section-5">Section 5 of [RFC5280]</a>. |
| 511 |
|
| 512 |
-----BEGIN X509 CRL----- |
| 513 |
MIIB9DCCAV8CAQEwCwYJKoZIhvcNAQEFMIIBCDEXMBUGA1UEChMOVmVyaVNpZ24s |
| 514 |
IEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxRjBEBgNVBAsT |
| 515 |
PXd3dy52ZXJpc2lnbi5jb20vcmVwb3NpdG9yeS9SUEEgSW5jb3JwLiBieSBSZWYu |
| 516 |
LExJQUIuTFREKGMpOTgxHjAcBgNVBAsTFVBlcnNvbmEgTm90IFZhbGlkYXRlZDEm |
| 517 |
MCQGA1UECxMdRGlnaXRhbCBJRCBDbGFzcyAxIC0gTmV0c2NhcGUxGDAWBgNVBAMU |
| 518 |
D1NpbW9uIEpvc2Vmc3NvbjEiMCAGCSqGSIb3DQEJARYTc2ltb25Aam9zZWZzc29u |
| 519 |
Lm9yZxcNMDYxMjI3MDgwMjM0WhcNMDcwMjA3MDgwMjM1WjAjMCECEC4QNwPfRoWd |
| 520 |
elUNpllhhTgXDTA2MTIyNzA4MDIzNFowCwYJKoZIhvcNAQEFA4GBAD0zX+J2hkcc |
| 521 |
Nbrq1Dn5IKL8nXLgPGcHv1I/le1MNo9t1ohGQxB5HnFUkRPAY82fR6Epor4aHgVy |
| 522 |
b+5y+neKN9Kn2mPF4iiun+a4o26CjJ0pArojCL1p8T0yyi9Xxvyc/ezaZ98HiIyP |
| 523 |
c3DGMNR+oUmSjKZ0jIhAYmeLxaPHfQwR |
| 524 |
-----END X509 CRL----- |
| 525 |
|
| 526 |
Figure 8: CRL Example |
| 527 |
|
| 528 |
Historically, the label "CRL" has rarely been used. Today, it is not |
| 529 |
common and many popular tools do not understand the label. |
| 530 |
Therefore, this document standardizes "X509 CRL" in order to promote |
| 531 |
interoperability and backwards-compatibility. Generators conforming |
| 532 |
to this document MUST generate "X509 CRL" labels and MUST NOT |
| 533 |
generate "CRL" labels. Parsers SHOULD NOT treat "CRL" as equivalent |
| 534 |
to "X509 CRL". |
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
<span class="grey">Josefsson & Leonard Standards Track [Page 10]</span></pre> |
| 557 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span> |
| 558 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 559 |
|
| 560 |
|
| 561 |
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Textual Encoding of PKCS #10 Certification Request Syntax</span> |
| 562 |
|
| 563 |
PKCS #10 Certification Requests are encoded using the |
| 564 |
"CERTIFICATE REQUEST" label. The encoded data MUST be a BER (DER |
| 565 |
strongly preferred; see <a href="#appendix-B">Appendix B</a>) encoded ASN.1 |
| 566 |
CertificationRequest structure as described in [<a href="./rfc2986" title=""PKCS #10: Certification Request Syntax Specification Version 1.7"">RFC2986</a>]. |
| 567 |
|
| 568 |
-----BEGIN CERTIFICATE REQUEST----- |
| 569 |
MIIBWDCCAQcCAQAwTjELMAkGA1UEBhMCU0UxJzAlBgNVBAoTHlNpbW9uIEpvc2Vm |
| 570 |
c3NvbiBEYXRha29uc3VsdCBBQjEWMBQGA1UEAxMNam9zZWZzc29uLm9yZzBOMBAG |
| 571 |
ByqGSM49AgEGBSuBBAAhAzoABLLPSkuXY0l66MbxVJ3Mot5FCFuqQfn6dTs+9/CM |
| 572 |
EOlSwVej77tj56kj9R/j9Q+LfysX8FO9I5p3oGIwYAYJKoZIhvcNAQkOMVMwUTAY |
| 573 |
BgNVHREEETAPgg1qb3NlZnNzb24ub3JnMAwGA1UdEwEB/wQCMAAwDwYDVR0PAQH/ |
| 574 |
BAUDAwegADAWBgNVHSUBAf8EDDAKBggrBgEFBQcDATAKBggqhkjOPQQDAgM/ADA8 |
| 575 |
AhxBvfhxPFfbBbsE1NoFmCUczOFApEuQVUw3ZP69AhwWXk3dgSUsKnuwL5g/ftAY |
| 576 |
dEQc8B8jAcnuOrfU |
| 577 |
-----END CERTIFICATE REQUEST----- |
| 578 |
|
| 579 |
Figure 9: PKCS #10 Example |
| 580 |
|
| 581 |
The label "NEW CERTIFICATE REQUEST" is also in wide use. Generators |
| 582 |
conforming to this document MUST generate "CERTIFICATE REQUEST" |
| 583 |
labels. Parsers MAY treat "NEW CERTIFICATE REQUEST" as equivalent to |
| 584 |
"CERTIFICATE REQUEST". |
| 585 |
|
| 586 |
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Textual Encoding of PKCS #7 Cryptographic Message Syntax</span> |
| 587 |
|
| 588 |
PKCS #7 Cryptographic Message Syntax structures are encoded using the |
| 589 |
"PKCS7" label. The encoded data MUST be a BER-encoded ASN.1 |
| 590 |
ContentInfo structure as described in [<a href="./rfc2315" title=""PKCS #7: Cryptographic Message Syntax Version 1.5"">RFC2315</a>]. |
| 591 |
|
| 592 |
-----BEGIN PKCS7----- |
| 593 |
MIHjBgsqhkiG9w0BCRABF6CB0zCB0AIBADFho18CAQCgGwYJKoZIhvcNAQUMMA4E |
| 594 |
CLfrI6dr0gUWAgITiDAjBgsqhkiG9w0BCRADCTAUBggqhkiG9w0DBwQIZpECRWtz |
| 595 |
u5kEGDCjerXY8odQ7EEEromZJvAurk/j81IrozBSBgkqhkiG9w0BBwEwMwYLKoZI |
| 596 |
hvcNAQkQAw8wJDAUBggqhkiG9w0DBwQI0tCBcU09nxEwDAYIKwYBBQUIAQIFAIAQ |
| 597 |
OsYGYUFdAH0RNc1p4VbKEAQUM2Xo8PMHBoYdqEcsbTodlCFAZH4= |
| 598 |
-----END PKCS7----- |
| 599 |
|
| 600 |
Figure 10: PKCS #7 Example |
| 601 |
|
| 602 |
The label "CERTIFICATE CHAIN" has been in use to denote a degenerate |
| 603 |
PKCS #7 structure that contains only a list of certificates (see |
| 604 |
<a href="./rfc2315#section-9">Section 9 of [RFC2315]</a>). Several modern tools do not support this |
| 605 |
label. Generators MUST NOT generate the "CERTIFICATE CHAIN" label. |
| 606 |
Parsers SHOULD NOT treat "CERTIFICATE CHAIN" as equivalent to |
| 607 |
"PKCS7". |
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
<span class="grey">Josefsson & Leonard Standards Track [Page 11]</span></pre> |
| 613 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span> |
| 614 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 615 |
|
| 616 |
|
| 617 |
PKCS #7 is an old specification that has long been superseded by CMS |
| 618 |
[<a href="./rfc5652" title=""Cryptographic Message Syntax (CMS)"">RFC5652</a>]. Implementations SHOULD NOT generate PKCS #7 when CMS is |
| 619 |
an alternative. |
| 620 |
|
| 621 |
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Textual Encoding of Cryptographic Message Syntax</span> |
| 622 |
|
| 623 |
Cryptographic Message Syntax structures are encoded using the "CMS" |
| 624 |
label. The encoded data MUST be a BER-encoded ASN.1 ContentInfo |
| 625 |
structure as described in [<a href="./rfc5652" title=""Cryptographic Message Syntax (CMS)"">RFC5652</a>]. |
| 626 |
|
| 627 |
-----BEGIN CMS----- |
| 628 |
MIGDBgsqhkiG9w0BCRABCaB0MHICAQAwDQYLKoZIhvcNAQkQAwgwXgYJKoZIhvcN |
| 629 |
AQcBoFEET3icc87PK0nNK9ENqSxItVIoSa0o0S/ISczMs1ZIzkgsKk4tsQ0N1nUM |
| 630 |
dvb05OXi5XLPLEtViMwvLVLwSE0sKlFIVHAqSk3MBkkBAJv0Fx0= |
| 631 |
-----END CMS----- |
| 632 |
|
| 633 |
Figure 11: CMS Example |
| 634 |
|
| 635 |
CMS is the IETF successor to PKCS #7. <a href="./rfc5652#section-1.1.1">Section 1.1.1 of [RFC5652]</a> |
| 636 |
describes the changes since PKCS #7 v1.5. Implementations SHOULD |
| 637 |
generate CMS when it is an alternative, promoting interoperability |
| 638 |
and forwards-compatibility. |
| 639 |
|
| 640 |
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. One Asymmetric Key and the Textual Encoding of PKCS #8 Private Key</span> |
| 641 |
<span class="h2"> Info</span> |
| 642 |
|
| 643 |
Unencrypted PKCS #8 Private Key Information Syntax structures |
| 644 |
(PrivateKeyInfo), renamed to Asymmetric Key Packages |
| 645 |
(OneAsymmetricKey), are encoded using the "PRIVATE KEY" label. The |
| 646 |
encoded data MUST be a BER (DER preferred; see <a href="#appendix-B">Appendix B</a>) encoded |
| 647 |
ASN.1 PrivateKeyInfo structure as described in PKCS #8 [<a href="./rfc5208" title=""Public-Key Cryptography Standards (PKCS) #8: Private-Key Information Syntax Specification Version 1.2"">RFC5208</a>], or |
| 648 |
a OneAsymmetricKey structure as described in [<a href="./rfc5958" title=""Asymmetric Key Packages"">RFC5958</a>]. The two are |
| 649 |
semantically identical and can be distinguished by version number. |
| 650 |
|
| 651 |
-----BEGIN PRIVATE KEY----- |
| 652 |
MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgVcB/UNPxalR9zDYAjQIf |
| 653 |
jojUDiQuGnSJrFEEzZPT/92hRANCAASc7UJtgnF/abqWM60T3XNJEzBv5ez9TdwK |
| 654 |
H0M6xpM2q+53wmsN/eYLdgtjgBd3DBmHtPilCkiFICXyaA8z9LkJ |
| 655 |
-----END PRIVATE KEY----- |
| 656 |
|
| 657 |
Figure 12: PKCS #8 PrivateKeyInfo (OneAsymmetricKey) Example |
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
<span class="grey">Josefsson & Leonard Standards Track [Page 12]</span></pre> |
| 669 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span> |
| 670 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 671 |
|
| 672 |
|
| 673 |
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. Textual Encoding of PKCS #8 Encrypted Private Key Info</span> |
| 674 |
|
| 675 |
Encrypted PKCS #8 Private Key Information Syntax structures |
| 676 |
(EncryptedPrivateKeyInfo), called the same in [<a href="./rfc5958" title=""Asymmetric Key Packages"">RFC5958</a>], are encoded |
| 677 |
using the "ENCRYPTED PRIVATE KEY" label. The encoded data MUST be a |
| 678 |
BER (DER preferred; see <a href="#appendix-B">Appendix B</a>) encoded ASN.1 |
| 679 |
EncryptedPrivateKeyInfo structure as described in PKCS #8 [<a href="./rfc5208" title=""Public-Key Cryptography Standards (PKCS) #8: Private-Key Information Syntax Specification Version 1.2"">RFC5208</a>] |
| 680 |
and [<a href="./rfc5958" title=""Asymmetric Key Packages"">RFC5958</a>]. |
| 681 |
|
| 682 |
-----BEGIN ENCRYPTED PRIVATE KEY----- |
| 683 |
MIHNMEAGCSqGSIb3DQEFDTAzMBsGCSqGSIb3DQEFDDAOBAghhICA6T/51QICCAAw |
| 684 |
FAYIKoZIhvcNAwcECBCxDgvI59i9BIGIY3CAqlMNBgaSI5QiiWVNJ3IpfLnEiEsW |
| 685 |
Z0JIoHyRmKK/+cr9QPLnzxImm0TR9s4JrG3CilzTWvb0jIvbG3hu0zyFPraoMkap |
| 686 |
8eRzWsIvC5SVel+CSjoS2mVS87cyjlD+txrmrXOVYDE+eTgMLbrLmsWh3QkCTRtF |
| 687 |
QC7k0NNzUHTV9yGDwfqMbw== |
| 688 |
-----END ENCRYPTED PRIVATE KEY----- |
| 689 |
|
| 690 |
Figure 13: PKCS #8 EncryptedPrivateKeyInfo Example |
| 691 |
|
| 692 |
<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. Textual Encoding of Attribute Certificates</span> |
| 693 |
|
| 694 |
Attribute certificates are encoded using the "ATTRIBUTE CERTIFICATE" |
| 695 |
label. The encoded data MUST be a BER (DER strongly preferred; see |
| 696 |
<a href="#appendix-B">Appendix B</a>) encoded ASN.1 AttributeCertificate structure as described |
| 697 |
in [<a href="./rfc5755" title=""An Internet Attribute Certificate Profile for Authorization"">RFC5755</a>]. |
| 698 |
|
| 699 |
-----BEGIN ATTRIBUTE CERTIFICATE----- |
| 700 |
MIICKzCCAZQCAQEwgZeggZQwgYmkgYYwgYMxCzAJBgNVBAYTAlVTMREwDwYDVQQI |
| 701 |
DAhOZXcgWW9yazEUMBIGA1UEBwwLU3RvbnkgQnJvb2sxDzANBgNVBAoMBkNTRTU5 |
| 702 |
MjE6MDgGA1UEAwwxU2NvdHQgU3RhbGxlci9lbWFpbEFkZHJlc3M9c3N0YWxsZXJA |
| 703 |
aWMuc3VueXNiLmVkdQIGARWrgUUSoIGMMIGJpIGGMIGDMQswCQYDVQQGEwJVUzER |
| 704 |
MA8GA1UECAwITmV3IFlvcmsxFDASBgNVBAcMC1N0b255IEJyb29rMQ8wDQYDVQQK |
| 705 |
DAZDU0U1OTIxOjA4BgNVBAMMMVNjb3R0IFN0YWxsZXIvZW1haWxBZGRyZXNzPXNz |
| 706 |
dGFsbGVyQGljLnN1bnlzYi5lZHUwDQYJKoZIhvcNAQEFBQACBgEVq4FFSjAiGA8z |
| 707 |
OTA3MDIwMTA1MDAwMFoYDzM5MTEwMTMxMDUwMDAwWjArMCkGA1UYSDEiMCCGHmh0 |
| 708 |
dHA6Ly9pZGVyYXNobi5vcmcvaW5kZXguaHRtbDANBgkqhkiG9w0BAQUFAAOBgQAV |
| 709 |
M9axFPXXozEFcer06bj9MCBBCQLtAM7ZXcZjcxyva7xCBDmtZXPYUluHf5OcWPJz |
| 710 |
5XPus/xS9wBgtlM3fldIKNyNO8RsMp6Ocx+PGlICc7zpZiGmCYLl64lAEGPO/bsw |
| 711 |
Smluak1aZIttePeTAHeJJs8izNJ5aR3Wcd3A5gLztQ== |
| 712 |
-----END ATTRIBUTE CERTIFICATE----- |
| 713 |
|
| 714 |
Figure 14: Attribute Certificate Example |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
<span class="grey">Josefsson & Leonard Standards Track [Page 13]</span></pre> |
| 725 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span> |
| 726 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 727 |
|
| 728 |
|
| 729 |
<span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>. Textual Encoding of Subject Public Key Info</span> |
| 730 |
|
| 731 |
Public keys are encoded using the "PUBLIC KEY" label. The encoded |
| 732 |
data MUST be a BER (DER preferred; see <a href="#appendix-B">Appendix B</a>) encoded ASN.1 |
| 733 |
SubjectPublicKeyInfo structure as described in <a href="./rfc5280#section-4.1.2.7">Section 4.1.2.7 of |
| 734 |
[RFC5280]</a>. |
| 735 |
|
| 736 |
-----BEGIN PUBLIC KEY----- |
| 737 |
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEn1LlwLN/KBYQRVH6HfIMTzfEqJOVztLe |
| 738 |
kLchp2hi78cCaMY81FBlYs8J9l7krc+M4aBeCGYFjba+hiXttJWPL7ydlE+5UG4U |
| 739 |
Nkn3Eos8EiZByi9DVsyfy9eejh+8AXgp |
| 740 |
-----END PUBLIC KEY----- |
| 741 |
|
| 742 |
Figure 15: Subject Public Key Info Example |
| 743 |
|
| 744 |
<span class="h2"><a class="selflink" id="section-14" href="#section-14">14</a>. Security Considerations</span> |
| 745 |
|
| 746 |
Data in this format often originates from untrusted sources, thus |
| 747 |
parsers must be prepared to handle unexpected data without causing |
| 748 |
security vulnerabilities. |
| 749 |
|
| 750 |
Implementers building implementations that rely on canonical |
| 751 |
representation or the ability to fingerprint a particular data object |
| 752 |
need to understand that this document does not define canonical |
| 753 |
encodings. The first ambiguity is introduced by permitting the text- |
| 754 |
encoded representation instead of the binary BER or DER encodings, |
| 755 |
but further ambiguities arise when multiple labels are treated as |
| 756 |
similar. Variations of whitespace and non-base64 alphabetic |
| 757 |
characters can create further ambiguities. Data encoding ambiguities |
| 758 |
also create opportunities for side channels. If canonical encodings |
| 759 |
are desired, the encoded structure must be decoded and processed into |
| 760 |
a canonical form (namely, DER encoding). |
| 761 |
|
| 762 |
<span class="h2"><a class="selflink" id="section-15" href="#section-15">15</a>. References</span> |
| 763 |
|
| 764 |
<span class="h3"><a class="selflink" id="section-15.1" href="#section-15.1">15.1</a>. Normative References</span> |
| 765 |
|
| 766 |
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate |
| 767 |
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997, |
| 768 |
<<a href="http://www.rfc-editor.org/info/rfc2119">http://www.rfc-editor.org/info/rfc2119</a>>. |
| 769 |
|
| 770 |
[<a id="ref-RFC2315">RFC2315</a>] Kaliski, B., "PKCS #7: Cryptographic Message Syntax |
| 771 |
Version 1.5", <a href="./rfc2315">RFC 2315</a>, March 1998, |
| 772 |
<<a href="http://www.rfc-editor.org/info/rfc2315">http://www.rfc-editor.org/info/rfc2315</a>>. |
| 773 |
|
| 774 |
[<a id="ref-RFC2986">RFC2986</a>] Nystrom, M. and B. Kaliski, "PKCS #10: Certification |
| 775 |
Request Syntax Specification Version 1.7", <a href="./rfc2986">RFC 2986</a>, |
| 776 |
November 2000, <<a href="http://www.rfc-editor.org/info/rfc2986">http://www.rfc-editor.org/info/rfc2986</a>>. |
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
<span class="grey">Josefsson & Leonard Standards Track [Page 14]</span></pre> |
| 781 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span> |
| 782 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 783 |
|
| 784 |
|
| 785 |
[<a id="ref-RFC4648">RFC4648</a>] Josefsson, S., "The Base16, Base32, and Base64 Data |
| 786 |
Encodings", <a href="./rfc4648">RFC 4648</a>, October 2006, |
| 787 |
<<a href="http://www.rfc-editor.org/info/rfc4648">http://www.rfc-editor.org/info/rfc4648</a>>. |
| 788 |
|
| 789 |
[<a id="ref-RFC5280">RFC5280</a>] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., |
| 790 |
Housley, R., and W. Polk, "Internet X.509 Public Key |
| 791 |
Infrastructure Certificate and Certificate Revocation List |
| 792 |
(CRL) Profile", <a href="./rfc5280">RFC 5280</a>, May 2008, |
| 793 |
<<a href="http://www.rfc-editor.org/info/rfc5280">http://www.rfc-editor.org/info/rfc5280</a>>. |
| 794 |
|
| 795 |
[<a id="ref-RFC5234">RFC5234</a>] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax |
| 796 |
Specifications: ABNF", STD 68, <a href="./rfc5234">RFC 5234</a>, January 2008, |
| 797 |
<<a href="http://www.rfc-editor.org/info/rfc5234">http://www.rfc-editor.org/info/rfc5234</a>>. |
| 798 |
|
| 799 |
[<a id="ref-RFC5652">RFC5652</a>] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, |
| 800 |
<a href="./rfc5652">RFC 5652</a>, September 2009, |
| 801 |
<<a href="http://www.rfc-editor.org/info/rfc5652">http://www.rfc-editor.org/info/rfc5652</a>>. |
| 802 |
|
| 803 |
[<a id="ref-RFC5755">RFC5755</a>] Farrell, S., Housley, R., and S. Turner, "An Internet |
| 804 |
Attribute Certificate Profile for Authorization", <a href="./rfc5755">RFC</a> |
| 805 |
<a href="./rfc5755">5755</a>, January 2010, |
| 806 |
<<a href="http://www.rfc-editor.org/info/rfc5755">http://www.rfc-editor.org/info/rfc5755</a>>. |
| 807 |
|
| 808 |
[<a id="ref-RFC5958">RFC5958</a>] Turner, S., "Asymmetric Key Packages", <a href="./rfc5958">RFC 5958</a>, August |
| 809 |
2010, <<a href="http://www.rfc-editor.org/info/rfc5958">http://www.rfc-editor.org/info/rfc5958</a>>. |
| 810 |
|
| 811 |
[<a id="ref-X.690">X.690</a>] International Telecommunications Union, "Information |
| 812 |
Technology - ASN.1 encoding rules: Specification of Basic |
| 813 |
Encoding Rules (BER), Canonical Encoding Rules (CER) and |
| 814 |
Distinguished Encoding Rules (DER)", ITU-T Recommendation |
| 815 |
X.690, ISO/IEC 8825-1:2008, November 2008. |
| 816 |
|
| 817 |
<span class="h3"><a class="selflink" id="section-15.2" href="#section-15.2">15.2</a>. Informative References</span> |
| 818 |
|
| 819 |
[<a id="ref-RFC934">RFC934</a>] Rose, M. and E. Stefferud, "Proposed standard for message |
| 820 |
encapsulation", <a href="./rfc934">RFC 934</a>, January 1985, |
| 821 |
<<a href="http://www.rfc-editor.org/info/rfc934">http://www.rfc-editor.org/info/rfc934</a>>. |
| 822 |
|
| 823 |
[<a id="ref-RFC1421">RFC1421</a>] Linn, J., "Privacy Enhancement for Internet Electronic |
| 824 |
Mail: Part I: Message Encryption and Authentication |
| 825 |
Procedures", <a href="./rfc1421">RFC 1421</a>, February 1993, |
| 826 |
<<a href="http://www.rfc-editor.org/info/rfc1421">http://www.rfc-editor.org/info/rfc1421</a>>. |
| 827 |
|
| 828 |
[<a id="ref-RFC2585">RFC2585</a>] Housley, R. and P. Hoffman, "Internet X.509 Public Key |
| 829 |
Infrastructure Operational Protocols: FTP and HTTP", <a href="./rfc2585">RFC</a> |
| 830 |
<a href="./rfc2585">2585</a>, May 1999, <<a href="http://www.rfc-editor.org/info/rfc2585">http://www.rfc-editor.org/info/rfc2585</a>>. |
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
<span class="grey">Josefsson & Leonard Standards Track [Page 15]</span></pre> |
| 837 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span> |
| 838 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 839 |
|
| 840 |
|
| 841 |
[<a id="ref-RFC4716">RFC4716</a>] Galbraith, J. and R. Thayer, "The Secure Shell (SSH) |
| 842 |
Public Key File Format", <a href="./rfc4716">RFC 4716</a>, November 2006, |
| 843 |
<<a href="http://www.rfc-editor.org/info/rfc4716">http://www.rfc-editor.org/info/rfc4716</a>>. |
| 844 |
|
| 845 |
[<a id="ref-RFC4880">RFC4880</a>] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. |
| 846 |
Thayer, "OpenPGP Message Format", <a href="./rfc4880">RFC 4880</a>, November 2007, |
| 847 |
<<a href="http://www.rfc-editor.org/info/rfc4880">http://www.rfc-editor.org/info/rfc4880</a>>. |
| 848 |
|
| 849 |
[<a id="ref-RFC5208">RFC5208</a>] Kaliski, B., "Public-Key Cryptography Standards (PKCS) #8: |
| 850 |
Private-Key Information Syntax Specification Version 1.2", |
| 851 |
<a href="./rfc5208">RFC 5208</a>, May 2008, |
| 852 |
<<a href="http://www.rfc-editor.org/info/rfc5208">http://www.rfc-editor.org/info/rfc5208</a>>. |
| 853 |
|
| 854 |
[<a id="ref-RFC7292">RFC7292</a>] Moriarty, K., Ed., Nystrom, M., Parkinson, S., Rusch, A., |
| 855 |
and M. Scott, "PKCS #12: Personal Information Exchange |
| 856 |
Syntax v1.1", <a href="./rfc7292">RFC 7292</a>, July 2014, |
| 857 |
<<a href="http://www.rfc-editor.org/info/rfc7292">http://www.rfc-editor.org/info/rfc7292</a>>. |
| 858 |
|
| 859 |
[<a id="ref-P7v1.6">P7v1.6</a>] Kaliski, B. and K. Kingdon, "Extensions and Revisions to |
| 860 |
PKCS #7 (Version 1.6 Bulletin)", May 1997, |
| 861 |
<<a href="http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/pkcs-7-cryptographic-message-syntax-standar.htm">http://www.emc.com/emc-plus/rsa-labs/</a> |
| 862 |
<a href="http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/pkcs-7-cryptographic-message-syntax-standar.htm">standards-initiatives/pkcs-7-cryptographic-message-</a> |
| 863 |
<a href="http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/pkcs-7-cryptographic-message-syntax-standar.htm">syntax-standar.htm</a>>. |
| 864 |
|
| 865 |
[<a id="ref-X.509SG">X.509SG</a>] Gutmann, P., "X.509 Style Guide", October 2000, |
| 866 |
<<a href="http://www.cs.auckland.ac.nz/~pgut001/pubs/x509guide.txt">http://www.cs.auckland.ac.nz/~pgut001/pubs/</a> |
| 867 |
<a href="http://www.cs.auckland.ac.nz/~pgut001/pubs/x509guide.txt">x509guide.txt</a>>. |
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
<span class="grey">Josefsson & Leonard Standards Track [Page 16]</span></pre> |
| 893 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span> |
| 894 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 895 |
|
| 896 |
|
| 897 |
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. Non-conforming Examples</span> |
| 898 |
|
| 899 |
This appendix contains examples for the non-recommended label |
| 900 |
variants described earlier in this document. As discussed earlier, |
| 901 |
supporting these is not required and is sometimes discouraged. |
| 902 |
Still, they can be useful for interoperability testing and for easy |
| 903 |
reference. |
| 904 |
|
| 905 |
-----BEGIN X509 CERTIFICATE----- |
| 906 |
MIIBHDCBxaADAgECAgIcxzAJBgcqhkjOPQQBMBAxDjAMBgNVBAMUBVBLSVghMB4X |
| 907 |
DTE0MDkxNDA2MTU1MFoXDTI0MDkxNDA2MTU1MFowEDEOMAwGA1UEAxQFUEtJWCEw |
| 908 |
WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATwoQSr863QrR0PoRIYQ96H7WykDePH |
| 909 |
Wa0eVAE24bth43wCNc+U5aZ761dhGhSSJkVWRgVH5+prLIr+nzfIq+X4oxAwDjAM |
| 910 |
BgNVHRMBAf8EAjAAMAkGByqGSM49BAEDRwAwRAIfMdKS5F63lMnWVhi7uaKJzKCs |
| 911 |
NnY/OKgBex6MIEAv2AIhAI2GdvfL+mGvhyPZE+JxRxWChmggb5/9eHdUcmW/jkOH |
| 912 |
-----END X509 CERTIFICATE----- |
| 913 |
|
| 914 |
Figure 16: Non-standard 'X509' Certificate Example |
| 915 |
|
| 916 |
-----BEGIN X.509 CERTIFICATE----- |
| 917 |
MIIBHDCBxaADAgECAgIcxzAJBgcqhkjOPQQBMBAxDjAMBgNVBAMUBVBLSVghMB4X |
| 918 |
DTE0MDkxNDA2MTU1MFoXDTI0MDkxNDA2MTU1MFowEDEOMAwGA1UEAxQFUEtJWCEw |
| 919 |
WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATwoQSr863QrR0PoRIYQ96H7WykDePH |
| 920 |
Wa0eVAE24bth43wCNc+U5aZ761dhGhSSJkVWRgVH5+prLIr+nzfIq+X4oxAwDjAM |
| 921 |
BgNVHRMBAf8EAjAAMAkGByqGSM49BAEDRwAwRAIfMdKS5F63lMnWVhi7uaKJzKCs |
| 922 |
NnY/OKgBex6MIEAv2AIhAI2GdvfL+mGvhyPZE+JxRxWChmggb5/9eHdUcmW/jkOH |
| 923 |
-----END X.509 CERTIFICATE----- |
| 924 |
|
| 925 |
Figure 17: Non-standard 'X.509' Certificate Example |
| 926 |
|
| 927 |
-----BEGIN NEW CERTIFICATE REQUEST----- |
| 928 |
MIIBWDCCAQcCAQAwTjELMAkGA1UEBhMCU0UxJzAlBgNVBAoTHlNpbW9uIEpvc2Vm |
| 929 |
c3NvbiBEYXRha29uc3VsdCBBQjEWMBQGA1UEAxMNam9zZWZzc29uLm9yZzBOMBAG |
| 930 |
ByqGSM49AgEGBSuBBAAhAzoABLLPSkuXY0l66MbxVJ3Mot5FCFuqQfn6dTs+9/CM |
| 931 |
EOlSwVej77tj56kj9R/j9Q+LfysX8FO9I5p3oGIwYAYJKoZIhvcNAQkOMVMwUTAY |
| 932 |
BgNVHREEETAPgg1qb3NlZnNzb24ub3JnMAwGA1UdEwEB/wQCMAAwDwYDVR0PAQH/ |
| 933 |
BAUDAwegADAWBgNVHSUBAf8EDDAKBggrBgEFBQcDATAKBggqhkjOPQQDAgM/ADA8 |
| 934 |
AhxBvfhxPFfbBbsE1NoFmCUczOFApEuQVUw3ZP69AhwWXk3dgSUsKnuwL5g/ftAY |
| 935 |
dEQc8B8jAcnuOrfU |
| 936 |
-----END NEW CERTIFICATE REQUEST----- |
| 937 |
|
| 938 |
Figure 18: Non-standard 'NEW' PKCS #10 Example |
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
<span class="grey">Josefsson & Leonard Standards Track [Page 17]</span></pre> |
| 949 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span> |
| 950 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 951 |
|
| 952 |
|
| 953 |
-----BEGIN CERTIFICATE CHAIN----- |
| 954 |
MIHjBgsqhkiG9w0BCRABF6CB0zCB0AIBADFho18CAQCgGwYJKoZIhvcNAQUMMA4E |
| 955 |
CLfrI6dr0gUWAgITiDAjBgsqhkiG9w0BCRADCTAUBggqhkiG9w0DBwQIZpECRWtz |
| 956 |
u5kEGDCjerXY8odQ7EEEromZJvAurk/j81IrozBSBgkqhkiG9w0BBwEwMwYLKoZI |
| 957 |
hvcNAQkQAw8wJDAUBggqhkiG9w0DBwQI0tCBcU09nxEwDAYIKwYBBQUIAQIFAIAQ |
| 958 |
OsYGYUFdAH0RNc1p4VbKEAQUM2Xo8PMHBoYdqEcsbTodlCFAZH4= |
| 959 |
-----END CERTIFICATE CHAIN----- |
| 960 |
|
| 961 |
Figure 19: Non-standard 'CERTIFICATE CHAIN' Example |
| 962 |
|
| 963 |
<span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. DER Expectations</span> |
| 964 |
|
| 965 |
This appendix is informative. Consult the respective standards for |
| 966 |
the normative rules. |
| 967 |
|
| 968 |
DER is a restricted profile of BER [<a href="#ref-X.690" title=""Information Technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)"">X.690</a>]; thus, all DER encodings |
| 969 |
of data values are BER encodings, but just one of the BER encodings |
| 970 |
is the DER encoding for a data value. Canonical encoding matters |
| 971 |
when performing cryptographic operations; additionally, canonical |
| 972 |
encoding has certain efficiency advantages for parsers. There are |
| 973 |
three principal reasons to encode with DER: |
| 974 |
|
| 975 |
1. A digital signature is (supposed to be) computed over the DER |
| 976 |
encoding of the semantic content, so providing anything other |
| 977 |
than the DER encoding is senseless. (In practice, an implementer |
| 978 |
might choose to have an implementation parse and digest the data |
| 979 |
as is, but this practice amounts to guesswork.) |
| 980 |
|
| 981 |
2. In practice, cryptographic hashes are computed over the DER |
| 982 |
encoding for identification. |
| 983 |
|
| 984 |
3. In practice, the content is small. DER always encodes data |
| 985 |
values in definite-length form (where the length is stated at the |
| 986 |
beginning of the encoding); thus, a parser can anticipate memory |
| 987 |
or resource usage up front. |
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
<span class="grey">Josefsson & Leonard Standards Track [Page 18]</span></pre> |
| 1005 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span> |
| 1006 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 1007 |
|
| 1008 |
|
| 1009 |
Figure 20 matches the structures in this document with the particular |
| 1010 |
reasons for DER encoding: |
| 1011 |
|
| 1012 |
Sec. Label Reasons |
| 1013 |
----+----------------------+------- |
| 1014 |
5 CERTIFICATE 1 2 ~3 |
| 1015 |
6 X509 CRL 1 |
| 1016 |
7 CERTIFICATE REQUEST 1 ~3 |
| 1017 |
8 PKCS7 * |
| 1018 |
9 CMS * |
| 1019 |
10 PRIVATE KEY 3 |
| 1020 |
11 ENCRYPTED PRIVATE KEY 3 |
| 1021 |
12 ATTRIBUTE CERTIFICATE 1 ~3 |
| 1022 |
13 PUBLIC KEY 2 3 |
| 1023 |
|
| 1024 |
Figure 20: Guide for DER Encoding |
| 1025 |
|
| 1026 |
* Cryptographic Message Syntax is designed for content of any length; |
| 1027 |
indefinite-length encoding enables one-pass processing (streaming) |
| 1028 |
when generating the encoding. Only certain parts -- namely, signed |
| 1029 |
and authenticated attributes -- need to be DER encoded. |
| 1030 |
|
| 1031 |
~ Although not always "small", these encoded structures should not be |
| 1032 |
particularly "large" (e.g., more than 16 kilobytes). The parser |
| 1033 |
ought to be informed of large things up front in any event; this is |
| 1034 |
yet another reason to DER encode these things in the first place. |
| 1035 |
|
| 1036 |
Figure 20: Guide for DER Encoding |
| 1037 |
|
| 1038 |
Acknowledgements |
| 1039 |
|
| 1040 |
Peter Gutmann suggested to document labels for Attribute Certificates |
| 1041 |
and PKCS #7 messages, and to add examples for the non-standard |
| 1042 |
variants. Dr. Stephen Henson suggested distinguishing when BER |
| 1043 |
versus DER is appropriate or necessary. |
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
<span class="grey">Josefsson & Leonard Standards Track [Page 19]</span></pre> |
| 1061 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span> |
| 1062 |
<span class="grey"><a href="./rfc7468">RFC 7468</a> PKIX Textual Encodings April 2015</span> |
| 1063 |
|
| 1064 |
|
| 1065 |
Authors' Addresses |
| 1066 |
|
| 1067 |
Simon Josefsson |
| 1068 |
SJD AB |
| 1069 |
Johan Olof Wallins Vaeg 13 |
| 1070 |
Solna 171 64 |
| 1071 |
Sweden |
| 1072 |
|
| 1073 |
EMail: [email protected] |
| 1074 |
URI: <a href="http://josefsson.org/">http://josefsson.org/</a> |
| 1075 |
|
| 1076 |
|
| 1077 |
Sean Leonard |
| 1078 |
Penango, Inc. |
| 1079 |
5900 Wilshire Boulevard |
| 1080 |
21st Floor |
| 1081 |
Los Angeles, CA 90036 |
| 1082 |
United States |
| 1083 |
|
| 1084 |
EMail: [email protected] |
| 1085 |
URI: <a href="http://www.penango.com/">http://www.penango.com/</a> |
| 1086 |
|
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
Josefsson & Leonard Standards Track [Page 20] |
| 1117 |
</pre> |