1-- Extracted from RFC4210
2-- by Martin Peylo <martin.peylo@nsn.com>
3--
4-- Changes to the original ASN.1 source:
5--   - Commented out the import of UTF8String which is not needed
6--   - Commented out PKIBody/p10cr since PKCS-10 is not implemented
7--   - Uncommented the definitions for the OIDs used in InfoTypeAndValue
8--
9-- The copyright statement from the original description in RFC4211
10-- follows below:
11--
12-- Full Copyright Statement
13--
14--    Copyright (C) The Internet Society (2005).
15--
16--    This document is subject to the rights, licenses and restrictions
17--    contained in BCP 78, and except as set forth therein, the authors
18--    retain all their rights.
19--
20--    This document and the information contained herein are provided on an
21--    "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
22--    OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
23--    ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
24--    INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
25--    INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
26--    WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
27
28     PKIXCMP {iso(1) identified-organization(3)
29           dod(6) internet(1) security(5) mechanisms(5) pkix(7)
30           id-mod(0) id-mod-cmp2000(16)}
31
32     DEFINITIONS EXPLICIT TAGS ::=
33
34     BEGIN
35
36     -- EXPORTS ALL --
37
38     IMPORTS
39
40         Certificate, CertificateList, Extensions, AlgorithmIdentifier --,
41         -- UTF8String
42	 -- if required; otherwise, comment out
43                FROM PKIX1Explicit88 {iso(1) identified-organization(3)
44                dod(6) internet(1) security(5) mechanisms(5) pkix(7)
45                id-mod(0) id-pkix1-explicit-88(1)}
46
47         GeneralName, KeyIdentifier
48                FROM PKIX1Implicit88 {iso(1) identified-organization(3)
49                dod(6) internet(1) security(5) mechanisms(5) pkix(7)
50                id-mod(0) id-pkix1-implicit-88(2)}
51
52         CertTemplate, PKIPublicationInfo, EncryptedValue, CertId,
53         CertReqMessages
54                FROM PKIXCRMF-2005 {iso(1) identified-organization(3)
55                dod(6) internet(1) security(5) mechanisms(5) pkix(7)
56                id-mod(0) id-mod-crmf2005(36)}
57
58         -- see also the behavioral clarifications to CRMF codified in
59         -- Appendix C of this specification
60
61         CertificationRequest
62                FROM PKCS-10 {iso(1) member-body(2)
63                              us(840) rsadsi(113549)
64                              pkcs(1) pkcs-10(10) modules(1) pkcs-10(1)}
65
66         -- (specified in RFC 2986 with 1993 ASN.1 syntax and IMPLICIT
67         -- tags).  Alternatively, implementers may directly include
68         -- the [PKCS10] syntax in this module
69
70         ;
71
72   -- the rest of the module contains locally-defined OIDs and
73   -- constructs
74
75      CMPCertificate ::= CHOICE {
76         x509v3PKCert        Certificate
77      }
78   -- This syntax, while bits-on-the-wire compatible with the
79   -- standard X.509 definition of "Certificate", allows the
80   -- possibility of future certificate types (such as X.509
81   -- attribute certificates, WAP WTLS certificates, or other kinds
82   -- of certificates) within this certificate management protocol,
83   -- should a need ever arise to support such generality.  Those
84   -- implementations that do not foresee a need to ever support
85   -- other certificate types MAY, if they wish, comment out the
86   -- above structure and "un-comment" the following one prior to
87   -- compiling this ASN.1 module.  (Note that interoperability
88   -- with implementations that don't do this will be unaffected by
89   -- this change.)
90
91   -- CMPCertificate ::= Certificate
92
93      PKIMessage ::= SEQUENCE {
94         header           PKIHeader,
95         body             PKIBody,
96         protection   [0] PKIProtection OPTIONAL,
97         extraCerts   [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
98                          OPTIONAL
99     }
100
101     PKIMessages ::= SEQUENCE SIZE (1..MAX) OF PKIMessage
102
103     PKIHeader ::= SEQUENCE {
104         pvno                INTEGER     { cmp1999(1), cmp2000(2) },
105         sender              GeneralName,
106         -- identifies the sender
107         recipient           GeneralName,
108         -- identifies the intended recipient
109         messageTime     [0] GeneralizedTime         OPTIONAL,
110         -- time of production of this message (used when sender
111         -- believes that the transport will be "suitable"; i.e.,
112         -- that the time will still be meaningful upon receipt)
113         protectionAlg   [1] AlgorithmIdentifier     OPTIONAL,
114         -- algorithm used for calculation of protection bits
115         senderKID       [2] KeyIdentifier           OPTIONAL,
116         recipKID        [3] KeyIdentifier           OPTIONAL,
117         -- to identify specific keys used for protection
118         transactionID   [4] OCTET STRING            OPTIONAL,
119         -- identifies the transaction; i.e., this will be the same in
120         -- corresponding request, response, certConf, and PKIConf
121         -- messages
122         senderNonce     [5] OCTET STRING            OPTIONAL,
123         recipNonce      [6] OCTET STRING            OPTIONAL,
124         -- nonces used to provide replay protection, senderNonce
125         -- is inserted by the creator of this message; recipNonce
126         -- is a nonce previously inserted in a related message by
127         -- the intended recipient of this message
128         freeText        [7] PKIFreeText             OPTIONAL,
129         -- this may be used to indicate context-specific instructions
130         -- (this field is intended for human consumption)
131         generalInfo     [8] SEQUENCE SIZE (1..MAX) OF
132                                InfoTypeAndValue     OPTIONAL
133         -- this may be used to convey context-specific information
134         -- (this field not primarily intended for human consumption)
135     }
136
137     PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
138         -- text encoded as UTF-8 String [RFC3629] (note: each
139         -- UTF8String MAY include an [RFC3066] language tag
140         -- to indicate the language of the contained text
141         -- see [RFC2482] for details)
142
143     PKIBody ::= CHOICE {       -- message-specific body elements
144         ir       [0]  CertReqMessages,        --Initialization Request
145         ip       [1]  CertRepMessage,         --Initialization Response
146         cr       [2]  CertReqMessages,        --Certification Request
147         cp       [3]  CertRepMessage,         --Certification Response
148         p10cr    [4]  CertificationRequest,   --imported from [PKCS10]
149         popdecc  [5]  POPODecKeyChallContent, --pop Challenge
150         popdecr  [6]  POPODecKeyRespContent,  --pop Response
151         kur      [7]  CertReqMessages,        --Key Update Request
152         kup      [8]  CertRepMessage,         --Key Update Response
153         krr      [9]  CertReqMessages,        --Key Recovery Request
154         krp      [10] KeyRecRepContent,       --Key Recovery Response
155         rr       [11] RevReqContent,          --Revocation Request
156         rp       [12] RevRepContent,          --Revocation Response
157         ccr      [13] CertReqMessages,        --Cross-Cert. Request
158         ccp      [14] CertRepMessage,         --Cross-Cert. Response
159         ckuann   [15] CAKeyUpdAnnContent,     --CA Key Update Ann.
160         cann     [16] CertAnnContent,         --Certificate Ann.
161         rann     [17] RevAnnContent,          --Revocation Ann.
162         crlann   [18] CRLAnnContent,          --CRL Announcement
163         pkiconf  [19] PKIConfirmContent,      --Confirmation
164         nested   [20] NestedMessageContent,   --Nested Message
165         genm     [21] GenMsgContent,          --General Message
166         genp     [22] GenRepContent,          --General Response
167         error    [23] ErrorMsgContent,        --Error Message
168         certConf [24] CertConfirmContent,     --Certificate confirm
169         pollReq  [25] PollReqContent,         --Polling request
170         pollRep  [26] PollRepContent          --Polling response
171     }
172
173     PKIProtection ::= BIT STRING
174
175     ProtectedPart ::= SEQUENCE {
176         header    PKIHeader,
177         body      PKIBody
178     }
179
180     id-PasswordBasedMac OBJECT IDENTIFIER ::= {1 2 840 113533 7 66 13}
181     PBMParameter ::= SEQUENCE {
182         salt                OCTET STRING,
183         -- note:  implementations MAY wish to limit acceptable sizes
184         -- of this string to values appropriate for their environment
185         -- in order to reduce the risk of denial-of-service attacks
186         owf                 AlgorithmIdentifier,
187         -- AlgId for a One-Way Function (SHA-1 recommended)
188         iterationCount      INTEGER,
189         -- number of times the OWF is applied
190         -- note:  implementations MAY wish to limit acceptable sizes
191         -- of this integer to values appropriate for their environment
192         -- in order to reduce the risk of denial-of-service attacks
193         mac                 AlgorithmIdentifier
194         -- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
195     }   -- or HMAC [RFC2104, RFC2202])
196
197     id-DHBasedMac OBJECT IDENTIFIER ::= {1 2 840 113533 7 66 30}
198     DHBMParameter ::= SEQUENCE {
199         owf                 AlgorithmIdentifier,
200         -- AlgId for a One-Way Function (SHA-1 recommended)
201         mac                 AlgorithmIdentifier
202         -- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
203     }   -- or HMAC [RFC2104, RFC2202])
204
205
206     NestedMessageContent ::= PKIMessages
207
208     PKIStatus ::= INTEGER {
209         accepted                (0),
210         -- you got exactly what you asked for
211         grantedWithMods        (1),
212         -- you got something like what you asked for; the
213         -- requester is responsible for ascertaining the differences
214         rejection              (2),
215         -- you don't get it, more information elsewhere in the message
216         waiting                (3),
217         -- the request body part has not yet been processed; expect to
218         -- hear more later (note: proper handling of this status
219         -- response MAY use the polling req/rep PKIMessages specified
220         -- in Section 5.3.22; alternatively, polling in the underlying
221         -- transport layer MAY have some utility in this regard)
222         revocationWarning      (4),
223         -- this message contains a warning that a revocation is
224         -- imminent
225         revocationNotification (5),
226         -- notification that a revocation has occurred
227         keyUpdateWarning       (6)
228         -- update already done for the oldCertId specified in
229         -- CertReqMsg
230     }
231
232     PKIFailureInfo ::= BIT STRING {
233     -- since we can fail in more than one way!
234     -- More codes may be added in the future if/when required.
235         badAlg              (0),
236         -- unrecognized or unsupported Algorithm Identifier
237         badMessageCheck     (1),
238         -- integrity check failed (e.g., signature did not verify)
239         badRequest          (2),
240         -- transaction not permitted or supported
241         badTime             (3),
242         -- messageTime was not sufficiently close to the system time,
243         -- as defined by local policy
244         badCertId           (4),
245         -- no certificate could be found matching the provided criteria
246         badDataFormat       (5),
247         -- the data submitted has the wrong format
248         wrongAuthority      (6),
249         -- the authority indicated in the request is different from the
250         -- one creating the response token
251         incorrectData       (7),
252         -- the requester's data is incorrect (for notary services)
253         missingTimeStamp    (8),
254         -- when the timestamp is missing but should be there
255         -- (by policy)
256         badPOP              (9),
257         -- the proof-of-possession failed
258         certRevoked         (10),
259            -- the certificate has already been revoked
260         certConfirmed       (11),
261            -- the certificate has already been confirmed
262         wrongIntegrity      (12),
263            -- invalid integrity, password based instead of signature or
264            -- vice versa
265         badRecipientNonce   (13),
266            -- invalid recipient nonce, either missing or wrong value
267         timeNotAvailable    (14),
268            -- the TSA's time source is not available
269         unacceptedPolicy    (15),
270            -- the requested TSA policy is not supported by the TSA.
271         unacceptedExtension (16),
272            -- the requested extension is not supported by the TSA.
273         addInfoNotAvailable (17),
274            -- the additional information requested could not be
275            -- understood or is not available
276         badSenderNonce      (18),
277            -- invalid sender nonce, either missing or wrong size
278         badCertTemplate     (19),
279            -- invalid cert. template or missing mandatory information
280         signerNotTrusted    (20),
281            -- signer of the message unknown or not trusted
282         transactionIdInUse  (21),
283            -- the transaction identifier is already in use
284         unsupportedVersion  (22),
285            -- the version of the message is not supported
286         notAuthorized       (23),
287            -- the sender was not authorized to make the preceding
288            -- request or perform the preceding action
289         systemUnavail       (24),
290         -- the request cannot be handled due to system unavailability
291         systemFailure       (25),
292         -- the request cannot be handled due to system failure
293         duplicateCertReq    (26)
294         -- certificate cannot be issued because a duplicate
295         -- certificate already exists
296     }
297
298     PKIStatusInfo ::= SEQUENCE {
299         status        PKIStatus,
300         statusString  PKIFreeText     OPTIONAL,
301         failInfo      PKIFailureInfo  OPTIONAL
302     }
303
304     OOBCert ::= CMPCertificate
305
306     OOBCertHash ::= SEQUENCE {
307         hashAlg     [0] AlgorithmIdentifier     OPTIONAL,
308         certId      [1] CertId                  OPTIONAL,
309         hashVal         BIT STRING
310         -- hashVal is calculated over the DER encoding of the
311         -- self-signed certificate with the identifier certID.
312     }
313
314     POPODecKeyChallContent ::= SEQUENCE OF Challenge
315     -- One Challenge per encryption key certification request (in the
316     -- same order as these requests appear in CertReqMessages).
317
318     Challenge ::= SEQUENCE {
319         owf                 AlgorithmIdentifier  OPTIONAL,
320
321         -- MUST be present in the first Challenge; MAY be omitted in
322         -- any subsequent Challenge in POPODecKeyChallContent (if
323         -- omitted, then the owf used in the immediately preceding
324         -- Challenge is to be used).
325
326         witness             OCTET STRING,
327         -- the result of applying the one-way function (owf) to a
328         -- randomly-generated INTEGER, A.  [Note that a different
329         -- INTEGER MUST be used for each Challenge.]
330         challenge           OCTET STRING
331         -- the encryption (under the public key for which the cert.
332         -- request is being made) of Rand, where Rand is specified as
333         --   Rand ::= SEQUENCE {
334         --      int      INTEGER,
335         --       - the randomly-generated INTEGER A (above)
336         --      sender   GeneralName
337         --       - the sender's name (as included in PKIHeader)
338         --   }
339     }
340
341     POPODecKeyRespContent ::= SEQUENCE OF INTEGER
342     -- One INTEGER per encryption key certification request (in the
343     -- same order as these requests appear in CertReqMessages).  The
344     -- retrieved INTEGER A (above) is returned to the sender of the
345     -- corresponding Challenge.
346
347     CertRepMessage ::= SEQUENCE {
348         caPubs       [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
349                          OPTIONAL,
350         response         SEQUENCE OF CertResponse
351     }
352
353     CertResponse ::= SEQUENCE {
354         certReqId           INTEGER,
355         -- to match this response with corresponding request (a value
356         -- of -1 is to be used if certReqId is not specified in the
357         -- corresponding request)
358         status              PKIStatusInfo,
359         certifiedKeyPair    CertifiedKeyPair    OPTIONAL,
360         rspInfo             OCTET STRING        OPTIONAL
361         -- analogous to the id-regInfo-utf8Pairs string defined
362         -- for regInfo in CertReqMsg [CRMF]
363     }
364
365     CertifiedKeyPair ::= SEQUENCE {
366         certOrEncCert       CertOrEncCert,
367         privateKey      [0] EncryptedValue      OPTIONAL,
368         -- see [CRMF] for comment on encoding
369         publicationInfo [1] PKIPublicationInfo  OPTIONAL
370     }
371
372     CertOrEncCert ::= CHOICE {
373         certificate     [0] CMPCertificate,
374         encryptedCert   [1] EncryptedValue
375     }
376
377     KeyRecRepContent ::= SEQUENCE {
378         status                  PKIStatusInfo,
379         newSigCert          [0] CMPCertificate OPTIONAL,
380         caCerts             [1] SEQUENCE SIZE (1..MAX) OF
381                                             CMPCertificate OPTIONAL,
382         keyPairHist         [2] SEQUENCE SIZE (1..MAX) OF
383                                             CertifiedKeyPair OPTIONAL
384     }
385
386     RevReqContent ::= SEQUENCE OF RevDetails
387
388     RevDetails ::= SEQUENCE {
389         certDetails         CertTemplate,
390         -- allows requester to specify as much as they can about
391         -- the cert. for which revocation is requested
392         -- (e.g., for cases in which serialNumber is not available)
393         crlEntryDetails     Extensions       OPTIONAL
394         -- requested crlEntryExtensions
395     }
396
397     RevRepContent ::= SEQUENCE {
398         status       SEQUENCE SIZE (1..MAX) OF PKIStatusInfo,
399         -- in same order as was sent in RevReqContent
400         revCerts [0] SEQUENCE SIZE (1..MAX) OF CertId
401                                             OPTIONAL,
402         -- IDs for which revocation was requested
403         -- (same order as status)
404         crls     [1] SEQUENCE SIZE (1..MAX) OF CertificateList
405         -- the resulting CRLs (there may be more than one)
406     }
407
408     CAKeyUpdAnnContent ::= SEQUENCE {
409         oldWithNew   CMPCertificate, -- old pub signed with new priv
410         newWithOld   CMPCertificate, -- new pub signed with old priv
411         newWithNew   CMPCertificate  -- new pub signed with new priv
412     }
413
414     CertAnnContent ::= CMPCertificate
415
416     RevAnnContent ::= SEQUENCE {
417         status              PKIStatus,
418         certId              CertId,
419         willBeRevokedAt     GeneralizedTime,
420         badSinceDate        GeneralizedTime,
421         crlDetails          Extensions  OPTIONAL
422         -- extra CRL details (e.g., crl number, reason, location, etc.)
423     }
424
425     CRLAnnContent ::= SEQUENCE OF CertificateList
426
427     CertConfirmContent ::= SEQUENCE OF CertStatus
428
429     CertStatus ::= SEQUENCE {
430        certHash    OCTET STRING,
431        -- the hash of the certificate, using the same hash algorithm
432        -- as is used to create and verify the certificate signature
433        certReqId   INTEGER,
434        -- to match this confirmation with the corresponding req/rep
435        statusInfo  PKIStatusInfo OPTIONAL
436     }
437
438     PKIConfirmContent ::= NULL
439
440     InfoTypeAndValue ::= SEQUENCE {
441         infoType               OBJECT IDENTIFIER,
442         infoValue              ANY DEFINED BY infoType  OPTIONAL
443     }
444     -- Example InfoTypeAndValue contents include, but are not limited
445     -- to, the following (un-comment in this ASN.1 module and use as
446     -- appropriate for a given environment):
447     --
448     --   id-it-caProtEncCert    OBJECT IDENTIFIER ::= {id-it 1}
449           CAProtEncCertValue      ::= CMPCertificate
450     --   id-it-signKeyPairTypes OBJECT IDENTIFIER ::= {id-it 2}
451           SignKeyPairTypesValue   ::= SEQUENCE OF AlgorithmIdentifier
452     --   id-it-encKeyPairTypes  OBJECT IDENTIFIER ::= {id-it 3}
453           EncKeyPairTypesValue    ::= SEQUENCE OF AlgorithmIdentifier
454     --   id-it-preferredSymmAlg OBJECT IDENTIFIER ::= {id-it 4}
455           PreferredSymmAlgValue   ::= AlgorithmIdentifier
456     --   id-it-caKeyUpdateInfo  OBJECT IDENTIFIER ::= {id-it 5}
457           CAKeyUpdateInfoValue    ::= CAKeyUpdAnnContent
458     --   id-it-currentCRL       OBJECT IDENTIFIER ::= {id-it 6}
459           CurrentCRLValue         ::= CertificateList
460     --   id-it-unsupportedOIDs  OBJECT IDENTIFIER ::= {id-it 7}
461           UnsupportedOIDsValue    ::= SEQUENCE OF OBJECT IDENTIFIER
462     --   id-it-keyPairParamReq  OBJECT IDENTIFIER ::= {id-it 10}
463           KeyPairParamReqValue    ::= OBJECT IDENTIFIER
464     --   id-it-keyPairParamRep  OBJECT IDENTIFIER ::= {id-it 11}
465           KeyPairParamRepValue    ::= AlgorithmIdentifier
466     --   id-it-revPassphrase    OBJECT IDENTIFIER ::= {id-it 12}
467           RevPassphraseValue      ::= EncryptedValue
468     --   id-it-implicitConfirm  OBJECT IDENTIFIER ::= {id-it 13}
469           ImplicitConfirmValue    ::= NULL
470     --   id-it-confirmWaitTime  OBJECT IDENTIFIER ::= {id-it 14}
471           ConfirmWaitTimeValue    ::= GeneralizedTime
472     --   id-it-origPKIMessage   OBJECT IDENTIFIER ::= {id-it 15}
473           OrigPKIMessageValue     ::= PKIMessages
474     --   id-it-suppLangTags     OBJECT IDENTIFIER ::= {id-it 16}
475           SuppLangTagsValue       ::= SEQUENCE OF UTF8String
476     --
477     -- where
478     --
479     --   id-pkix OBJECT IDENTIFIER ::= {
480     --      iso(1) identified-organization(3)
481     --      dod(6) internet(1) security(5) mechanisms(5) pkix(7)}
482     -- and
483     --   id-it   OBJECT IDENTIFIER ::= {id-pkix 4}
484     --
485     --
486     -- This construct MAY also be used to define new PKIX Certificate
487     -- Management Protocol request and response messages, or general-
488     -- purpose (e.g., announcement) messages for future needs or for
489     -- specific environments.
490
491     GenMsgContent ::= SEQUENCE OF InfoTypeAndValue
492
493     -- May be sent by EE, RA, or CA (depending on message content).
494     -- The OPTIONAL infoValue parameter of InfoTypeAndValue will
495     -- typically be omitted for some of the examples given above.
496     -- The receiver is free to ignore any contained OBJ. IDs that it
497     -- does not recognize. If sent from EE to CA, the empty set
498     -- indicates that the CA may send
499     -- any/all information that it wishes.
500     GenRepContent ::= SEQUENCE OF InfoTypeAndValue
501     -- Receiver MAY ignore any contained OIDs that it does not
502     -- recognize.
503
504     ErrorMsgContent ::= SEQUENCE {
505         pKIStatusInfo          PKIStatusInfo,
506         errorCode              INTEGER           OPTIONAL,
507         -- implementation-specific error codes
508         errorDetails           PKIFreeText       OPTIONAL
509         -- implementation-specific error details
510     }
511
512     PollReqContent ::= SEQUENCE OF SEQUENCE {
513         certReqId              INTEGER
514     }
515
516     PollRepContent ::= SEQUENCE OF SEQUENCE {
517         certReqId              INTEGER,
518         checkAfter             INTEGER,  -- time in seconds
519         reason                 PKIFreeText OPTIONAL
520     }
521
522     END -- of CMP module
523