aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/pkcs12/pkcs12.asn
blob: b55e718b6e503ce29d1f00f68c0f89b80b8f37a4 (plain)
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
PKCS-12 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
                 pkcs-12(12) modules(0)  pkcs-12(1)}

DEFINITIONS IMPLICIT TAGS ::=

BEGIN

-- EXPORTS ALL
-- All types and values defined in this module is exported for use in
-- other ASN.1 modules. 

IMPORTS

informationFramework
        FROM UsefulDefinitions {joint-iso-itu-t(2) ds(5) module(1)
        usefulDefinitions(0) 3}

Attribute
	FROM InformationFramework informationFramework

ContentInfo, --DigestInfo-- Digest, DigestAlgorithmIdentifier
	FROM PKCS-7 {iso(1) member-body(2) us(840) rsadsi(113549)
	pkcs(1) pkcs-7(7) modules(0) pkcs-7(1)}

--PrivateKeyInfo, EncryptedPrivateKeyInfo
--	FROM PKCS-8 {iso(1) member-body(2) us(840) rsadsi(113549)
--	pkcs(1) pkcs-8(8) modules(1) pkcs-8(1)}
--
--pkcs-9, friendlyName, localKeyId, certTypes, crlTypes
--	FROM PKCS-9 {iso(1) member-body(2) us(840) rsadsi(113549)
--	pkcs(1) pkcs-9(9) modules(0) pkcs-9(1) };--

-- A PKCS#8 IMPORT from below
AlgorithmIdentifier, ALGORITHM-IDENTIFIER
        FROM PKCS-5 {iso(1) member-body(2) us(840) rsadsi(113549)
        pkcs(1) pkcs-5(5) modules(16) pkcs-5(1)};


-- Object identifiers

--rsadsi	OBJECT IDENTIFIER ::= {iso(1) member-body(2) us(840) rsadsi(113549)}
--pkcs    OBJECT IDENTIFIER ::= {rsadsi pkcs(1)}
--pkcs-12	OBJECT IDENTIFIER ::= {pkcs 12}
--pkcs-12PbeIds                  	OBJECT IDENTIFIER ::= {pkcs-12 1}
--pbeWithSHAAnd128BitRC4          OBJECT IDENTIFIER ::= {pkcs-12PbeIds 1}
--pbeWithSHAAnd40BitRC4           OBJECT IDENTIFIER ::= {pkcs-12PbeIds 2}
--pbeWithSHAAnd3-KeyTripleDES-CBC	OBJECT IDENTIFIER ::= {pkcs-12PbeIds 3}
--pbeWithSHAAnd2-KeyTripleDES-CBC	OBJECT IDENTIFIER ::= {pkcs-12PbeIds 4}
--pbeWithSHAAnd128BitRC2-CBC      OBJECT IDENTIFIER ::= {pkcs-12PbeIds 5}
--pbewithSHAAnd40BitRC2-CBC       OBJECT IDENTIFIER ::= {pkcs-12PbeIds 6}

--bagtypes			OBJECT IDENTIFIER ::= {pkcs-12 10 1}

-- The PFX PDU

PFX ::= SEQUENCE {
    	version		INTEGER {v3(3)}(v3,...),
    	authSafe	ContentInfo,
    	macData    	MacData OPTIONAL
}

MacData ::= SEQUENCE {
    	mac 		DigestInfo,
	macSalt	        OCTET STRING,
	iterations	INTEGER DEFAULT 1
-- Note: The default is for historical reasons and its use is
-- deprecated. A higher value, like 1024 is recommended.
}

-- Imported from PKCS#7
DigestInfo ::= SEQUENCE {
        digestAlgorithm DigestAlgorithmIdentifier,
        digest		Digest
}

AuthenticatedSafe ::= SEQUENCE OF ContentInfo
	-- Data if unencrypted
	-- EncryptedData if password-encrypted
	-- EnvelopedData if public key-encrypted

SafeContents ::= SEQUENCE OF SafeBag

SafeBag ::= SEQUENCE {
  	bagId	      	-- BAG-TYPE.&id ({PKCS12BagSet}) -- OBJECT IDENTIFIER,
  	bagValue      	[0] EXPLICIT --BAG-TYPE.&Type({PKCS12BagSet}{@bagId}) -- ANY,
  	bagAttributes 	SET OF PKCS12Attribute OPTIONAL
}

-- Bag types

--keyBag 	  BAG-TYPE ::= 
--	{KeyBag IDENTIFIED BY {bagtypes 1}}
--pkcs8ShroudedKeyBag BAG-TYPE ::=
--	{PKCS8ShroudedKeyBag IDENTIFIED BY {bagtypes 2}}
--certBag BAG-TYPE ::= 
--	{CertBag IDENTIFIED BY {bagtypes 3}}
--crlBag BAG-TYPE ::=
--	{CRLBag IDENTIFIED BY {bagtypes 4}}
--secretBag BAG-TYPE ::=    
--	{SecretBag IDENTIFIED BY {bagtypes 5}}
--safeContentsBag BAG-TYPE ::=
--	{SafeContents IDENTIFIED BY {bagtypes 6}}

--PKCS12BagSet BAG-TYPE ::= {
--	keyBag | 
--	pkcs8ShroudedKeyBag |
--	certBag |
--	crlBag | 
--	secretBag | 
--	safeContentsBag,
--	... - - For future extensions
--}

--BAG-TYPE ::= TYPE-IDENTIFIER

-- KeyBag

KeyBag ::= PrivateKeyInfo

-- Shrouded KeyBag

PKCS8ShroudedKeyBag ::= EncryptedPrivateKeyInfo

-- CertBag

CertBag ::= SEQUENCE {
	certId    --BAG-TYPE.&id   ({CertTypes}) -- OBJECT IDENTIFIER,
	certValue [0] EXPLICIT --BAG-TYPE.&Type ({CertTypes}{@certId})-- ANY
}

--x509Certificate BAG-TYPE ::=
--	{OCTET STRING IDENTIFIED BY {certTypes 1}}
	-- DER-encoded X.509 certificate stored in OCTET STRING
--sdsiCertificate BAG-TYPE ::=
--	{IA5String IDENTIFIED BY {certTypes 2}}
	-- Base64-encoded SDSI certificate stored in IA5String

--CertTypes BAG-TYPE ::= {
--	x509Certificate |
--	sdsiCertificate,
--	... - - For future extensions
--}

-- CRLBag

CRLBag ::= SEQUENCE {
	crlId     	--BAG-TYPE.&id ({CRLTypes})-- OBJECT IDENTIFIER,
	crlValue 	[0] EXPLICIT --BAG-TYPE.&Type ({CRLTypes}{@crlId})-- ANY
}

--x509CRL BAG-TYPE ::=
--	{OCTET STRING IDENTIFIED BY {crlTypes 1}}
	-- DER-encoded X.509 CRL stored in OCTET STRING

--CRLTypes BAG-TYPE ::= {
--	x509CRL,
--	... - - For future extensions
--}

-- Secret Bag

SecretBag ::= SEQUENCE {
	secretTypeId --BAG-TYPE.&id ({SecretTypes})-- OBJECT IDENTIFIER,
	secretValue  [0] EXPLICIT --BAG-TYPE.&Type ({SecretTypes}{@secretTypeId})-- ANY
}

--SecretTypes BAG-TYPE ::= {
--	... - - For future extensions
--}

-- Attributes

PKCS12Attribute ::= SEQUENCE {
	attrId	   	--ATTRIBUTE.&id ({PKCS12AttrSet})-- OBJECT IDENTIFIER,
	attrValues 	SET OF --ATTRIBUTE.&Type ({PKCS12AttrSet}{@attrId})-- ANY
} -- This type is compatible with the X.500 type 'Attribute'

--PKCS12AttrSet ATTRIBUTE ::= {
--	friendlyName |
--	localKeyId,
--	... - - Other attributes are allowed
--}

--END

-- We import PKCS#8 here directly rather than creating another dissector

--PKCS-8 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-8(8)
--        modules(1) pkcs-8(1)} 

-- $Revision: 1.5 $

-- This module has been checked for conformance with the ASN.1
-- standard by the OSS ASN.1 Tools

--DEFINITIONS IMPLICIT TAGS ::= 

--BEGIN

-- EXPORTS All --
-- All types and values defined in this module is exported for use in other
-- ASN.1 modules.

--IMPORTS

--informationFramework
--        FROM UsefulDefinitions {joint-iso-itu-t(2) ds(5) module(1)
--                                usefulDefinitions(0) 3} 

--Attribute
--        FROM InformationFramework informationFramework

--AlgorithmIdentifier, ALGORITHM-IDENTIFIER
--        FROM PKCS-5 {iso(1) member-body(2) us(840) rsadsi(113549)
--        pkcs(1) pkcs-5(5) modules(16) pkcs-5(1)};

-- Private-key information syntax

PrivateKeyInfo ::= SEQUENCE {
  version Version,
  privateKeyAlgorithm AlgorithmIdentifier --{{PrivateKeyAlgorithms}}--,
  privateKey PrivateKey,
  attributes [0] Attributes OPTIONAL }

Version ::= INTEGER {v1(0)} (v1,...)

PrivateKey ::= OCTET STRING

Attributes ::= SET OF Attribute

-- Encrypted private-key information syntax

EncryptedPrivateKeyInfo ::= SEQUENCE {
    encryptionAlgorithm AlgorithmIdentifier --{{KeyEncryptionAlgorithms}}--,
    encryptedData EncryptedData 
}

EncryptedData ::= OCTET STRING

--PrivateKeyAlgorithms ALGORITHM-IDENTIFIER ::= {
--    ... - - For local profiles
--}

--KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
--    ... - - For local profiles
--}

-- From RFC 2898
PBEParameter ::= SEQUENCE {
    salt		OCTET STRING,
    iterationCount 	INTEGER
}


PBKDF2Params ::= SEQUENCE {
    salt CHOICE {
        specified OCTET STRING,
	otherSource AlgorithmIdentifier --{{PBKDF2-SaltSources}}--
	},
    iterationCount INTEGER --(1..MAX)--,
    keyLength INTEGER (1..MAX) OPTIONAL,
    prf AlgorithmIdentifier --{{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1-- OPTIONAL }

PBES2Params ::= SEQUENCE {
    keyDerivationFunc AlgorithmIdentifier --{{PBES2-KDFs}}--,
    encryptionScheme AlgorithmIdentifier --{{PBES2-Encs}}-- }

PBMAC1Params ::=  SEQUENCE {
    keyDerivationFunc AlgorithmIdentifier --{{PBMAC1-KDFs}}--,
    messageAuthScheme AlgorithmIdentifier --{{PBMAC1-MACs}}-- }


END