-
Notifications
You must be signed in to change notification settings - Fork 4
/
78.txt
205 lines (150 loc) · 10.3 KB
/
78.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
[7] [DFN[[[CMS]]]] / [DFN[[[PKCS #7]]]] は、[[暗号化]]や[[署名]]が行われたデータを表現する構文
(の[[仕様書]]) です。
* 仕様書
[REFS[
- [21] [CITE@en[RFC 5652 - Cryptographic Message Syntax (CMS)]] ([TIME[2015-03-25 06:18:53 +09:00]] 版) <https://tools.ietf.org/html/rfc5652>
- [24] [CITE@en-US[NSS Certificate Download Specification - Mozilla | MDN]] ([TIME[2014-05-07 16:41:21 +09:00]] 版) <https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Certificate_Download_Specification>
- [33] [CITE@en[RFC 7468 - Textual Encodings of PKIX, PKCS, and CMS Structures]] ([TIME[2015-04-20 12:22:43 +09:00]] 版) <https://tools.ietf.org/html/rfc7468#section-8>
- [38] [CITE@en[RFC 7468 - Textual Encodings of PKIX, PKCS, and CMS Structures]] ([TIME[2015-04-20 12:22:43 +09:00]] 版) <https://tools.ietf.org/html/rfc7468#section-9>
]REFS]
* 意味
[40] [[IETF]] の見解では、 [[PKCS #7]] が [[IETF]] に移管されて改訂したものが
[[CMS]] のようです。後継ではありますが、別物と認識されていると思われます。
実際にはその歴史的連続性から、 [[CMS]] のことを [[PKCS #7]] と呼んだり、
[[PKCS #7]] 時代も含めて [[CMS]] と呼んだりもするようです。また [[CMS]]
が最新版となって久しいとはいえ、未だ元の [[PKCS #7]] にしか対応していない実装もあるようです。
[41] より話を複雑にしているのは、本来の [[PKCS #7]]/[[CMS]] のデータ形式ではなく、
その一部分であるべき構造を取り出した形の [[PKCS #7証明書鎖]] (>>8)
が (もしかすると本来の形よりも) よく用いられており、そちらが単に
「[[PKCS #7]]」や「[[CMS]]」と呼ばれることも多々あるようです。
しかも本来の形式は [[PKCS]] 標準に加えて [[RFC]] 化されていたのに対して、
証明書鎖形式は [[Netscape]] 社の独自仕様を他社も実装したものであり、
[[Netscape]] 社の消滅後は [[Mozilla]] プロジェクトが引き継いだ [SRC[>>24]]
とはいえ、標準仕様の存在が不明瞭な状態で、混乱を助長しています。
* 構文
[45] [[ASN.1の日時形式]]
* 文脈
[19] [[PKCS #7]] で規定されるデータ構造は次の場面で使われています。
[FIG(middle list)[
- [[PKCS #7証明書鎖]] (>>8)
- [[PKCS #12]]
- [[Netscape Certificate Sequence]]
- [CODE(MIME)@en[[[application/x-x509-ca-ra-cert]]]]
- [CODE(MIME)@en[[[application/x-x509-next-ca-cert]]]]
]FIG]
* [CODE[.pem]] 符号化
[34] [CODE[[[.pem]]]] ファイルでは、ラベルとして [[PKCS #7]] の [DFN[[CODE[[[PKCS7]]]]]]
[SRC[>>33]] や [[CMS]] の [DFN[[CODE[[[CMS]]]]]] [SRC[>>38]] が用いられます。。
[35] データは、それぞれの仕様の [[ASN.1]] [CODE[[[ContentInfo]]]]
でなければ[['''なりません''']]
[SRC[>>33, >>38]]。 [[BER]] を使わなければ[['''なりません''']] [SRC[>>33, >>38]]。
* PKCS #7 証明書鎖
[8] [DFN[[RUBYB[PKCS #7 証明書鎖][PKCS#7 certificate chain]]]] [SRC[>>24]] や
「[[PKCS #7]] 形式」、[[拡張子]] [CODE[[[.p7b]]]] で表されるデータ形式は、
[[証明書]]群や [[CRL]] をまとめたものです。
[25] [[NSS]] や [[Windows]] などで使われています。
[[証明書鎖]]の標準的な[[ファイル形式]]の1つです。
[22] [[Windows]] では「Cryptographic Message Syntax Standard - PKCS #7 証明書」
と呼ばれています。
;; [12] [[Windows]] には標準で [CODE[.p7b]] ファイルの内容を表示できるビューアーが入っているようです。
;; [14] [[拡張子]]は他に [CODE[[[.spc]]]], [CODE[[[.p7a]]]], [CODE[[[.p7c]]]] [SRC[>>13]] や
[CODE[[[.p7]]]] が使われることがあるようです。いずれも実質的に同じデータ形式を指しているらしいです。
[9] これは [[PKCS #7]] の [CODE[[[SignedData]]]] データ構造のみを用いて、
1つ以上の[[証明書]]を含めたものです [SRC[>>24]]。
[CODE[[[version]]]], [CODE[[[digestAlgorithms]]]],
[CODE[[[contentInfo]]]], [CODE[[[crls]]]], [CODE[[[signerInfos]]]]
は無視されます [SRC[>>24]]。
;; [28] しかし [[CRL]] を含めることもあるようです [SRC[>>27]]。
[20] [[ASN.1]] 仕様上[[証明書]]の順番は保持できないようです [SRC[>>5]] が、
[[証明書ダウンロード]]仕様としては順序が意味を持ちます。実際にどう扱われているのかは不明です。
[10] [[certification path]] 上の[[証明書]]をまとめて1つのファイルとして扱う時などに使われます。
[11] 本形式は [[BER]] によって符号化された[[バイナリーファイル]]といわれます。
[29] しかし [[DER]] が使われることもあるようです [SRC[>>23, >>27]]。
[26] 更に [CODE[[[.pem]]]] 形式で符号化されて[[証明書ダウンロード]]に用いられることがあります。
(そのままで[[証明書ダウンロード]]に用いられることもあります。)
[37] [[証明書ダウンロード]]仕様書では、ラベルとして [CODE[[[CERTIFICATE]]]]
を使っています [SRC[>>24]]。 [[RFC 7468]] は、 [DFN[[CODE[[[CERTIFICATE CHAIN]]]]]]
が使われることがあるが、対応していない実装もある [SRC[>>33]] としています。
[CODE[[[CERTIFICATE CHAIN]]]] を生成しては[['''なりません''']] [SRC[>>33]]。
構文解析器は [CODE[[[CERTIFICATE CHAIN]]]] を [CODE[[[PKCS7]]]]
と解釈する[['''べきではありません''']] [SRC[>>33]]。
* 歴史
[FIG(quote)[
[FIGCAPTION[
[1] [CITE[RSA Laboratories - PKCS #7: Cryptographic Message Syntax Standard]]
([TIME[2015-04-07 12:20:24 +09:00]] 版)
<http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/pkcs-7-cryptographic-message-syntax-standar.htm>
]FIGCAPTION]
> This standard describes general syntax for data that may have cryptography applied to it, such as digital signatures and digital envelopes.
> In support of the SET protocol for secure electronic transactions, RSA Laboratories has produced a bulletin detailing changes to be made to PKCS #7 version 1.5 to update it to version 1.6 (which has not yet been published). Version 1.5 is still recommended for general use, and is the basis for the S/MIME specification.
]FIG]
[3] [CITE@ja[PKCS #7 ファイル内の証明書を表示する]]
([TIME[2015-04-07 12:37:49 +09:00]] 版)
<https://msdn.microsoft.com/ja-jp/library/cc758042(v=ws.10).aspx>
[4] [CITE@ja[PKCS#7 から PKCS#12 への変換 - あきそふと開発日記]]
([TIME[2015-04-07 12:38:29 +09:00]] 版)
<http://akisoftware.com/cgi-bin/blom.exe?akisoft+sl+2df3bf285450ec962202070ee9f87c3591c3d74f>
[5] [CITE[tls - What's the difference between X.509 and PKCS#7 Certificate? - Information Security Stack Exchange]]
([TIME[2015-04-07 12:38:40 +09:00]] 版)
<http://security.stackexchange.com/questions/73156/whats-the-difference-between-x-509-and-pkcs7-certificate>
[6] [CITE[荐惹�吾��<ゃ�就綣��ゃ�]]
([TIME[2009-05-14 20:39:44 +09:00]] �)
<http://moca.wide.ad.jp/moca_guide/about_fileformat.html>
[FIG(quote)[
[FIGCAPTION[
[13] [CITE[Certificates]]
([TIME[2008-09-01 17:55:10 +09:00]] 版)
<http://supportline.microfocus.com/documentation/books/nx51ws01/cjcert.htm>
]FIGCAPTION]
> As well as the original PKCS #7, there are three revisions: a, b, and c. The standard extensions for these four versions are .spc, .p7a, .p7b and .p7c respectively.
]FIG]
[REFS[
- [16] [CITE@en[RFC 2311 - S/MIME Version 2 Message Specification]]
([TIME[2015-02-08 22:38:58 +09:00]] 版)
<https://tools.ietf.org/html/rfc2311#section-3.2>
- [2] [CITE@en[RFC 2315 - PKCS #7: Cryptographic Message Syntax Version 1.5]]
([TIME[2015-01-18 22:47:06 +09:00]] 版)
<https://tools.ietf.org/html/rfc2315>
- [15] [CITE@en[RFC 5751 - Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.2 Message Specification]]
([TIME[2015-02-18 20:19:43 +09:00]] 版)
<https://tools.ietf.org/html/rfc5751#section-3.2>
]REFS]
[FIG(quote)[
[FIGCAPTION[
[17] [CITE@en[RFC 2311 - S/MIME Version 2 Message Specification]]
([TIME[2015-02-08 22:38:58 +09:00]] 版)
<https://tools.ietf.org/html/rfc2311#appendix-C.1>
]FIGCAPTION]
> Some early implementations of S/MIME agents used the following MIME
> types:
> application/x-pkcs7-mime
> application/x-pkcs7-signature
]FIG]
[18] [CITE@en[243833 – Attachments of Content-Type: application/pkcs7-mime that contain non-standard contents fail to decode and are not shown]]
([TIME[2015-04-07 23:32:42 +09:00]] 版)
<https://bugzilla.mozilla.org/show_bug.cgi?id=243833>
[23] [CITE[pkcs7 - PKCS#7 utility]]
([TIME[2015-04-11 00:07:01 +09:00]] 版)
<https://www.openssl.org/docs/apps/pkcs7.html>
[27] [CITE[crl2pkcs7 - Create a PKCS#7 structure from a CRL and certificates.]]
([TIME[2015-04-12 12:52:55 +09:00]] 版)
<https://www.openssl.org/docs/apps/crl2pkcs7.html>
[30] [CITE@en[RFC 3335 - MIME-based Secure Peer-to-Peer Business Data Interchange over the Internet]]
([TIME[2015-03-08 18:20:36 +09:00]] 版)
<http://tools.ietf.org/html/rfc3335#section-5.2>
[31] [[CMS]] は [[PKCS #7]] の新版ですが、最早 [[PKCS #7]] ではなく、それを元にした新仕様との位置付けのようです。
[32] [[PKCS #7]] にのみ対応していて、 [[CMS]] には対応していない実装も珍しくはないようです。
[36] 実装は、 [[CMS]] を使えるなら [[PKCS #7]] を使う[['''べきではありません''']] [SRC[>>33, >>38]]。
[39] [CITE@en[RFC 5024 - ODETTE File Transfer Protocol 2.0]]
([TIME[2015-05-10 19:17:50 +09:00]] 版)
<https://tools.ietf.org/html/rfc5024>
[42] [CITE@en[RFC 5083 - Cryptographic Message Syntax (CMS) Authenticated-Enveloped-Data Content Type]]
([TIME[2015-07-26 16:34:51 +09:00]] 版)
<https://tools.ietf.org/html/rfc5083>
[43] [CITE@en[RFC 5084 - Using AES-CCM and AES-GCM Authenticated Encryption in the Cryptographic Message Syntax (CMS)]]
([TIME[2015-07-26 13:11:35 +09:00]] 版)
<https://tools.ietf.org/html/rfc5084>
[44] [CITE@en[RFC 5126 - CMS Advanced Electronic Signatures (CAdES)]]
([TIME[2015-07-26 16:12:30 +09:00]] 版)
<https://tools.ietf.org/html/rfc5126>
[46] [CITE@en[rfc4073]], [TIME[2021-07-05T05:48:12.000Z]] <https://datatracker.ietf.org/doc/html/rfc4073>