1/* Generated from cms.asn1 */
2/* Do not edit */
3
4#ifndef __cms_asn1_h__
5#define __cms_asn1_h__
6
7#include <stddef.h>
8#include <time.h>
9
10#ifndef __asn1_common_definitions__
11#define __asn1_common_definitions__
12
13#ifndef __HEIM_BASE_DATA__
14#define __HEIM_BASE_DATA__ 1
15struct heim_base_data {
16 size_t length;
17 void *data;
18};
19typedef struct heim_base_data heim_octet_string;
20#endif
21
22typedef struct heim_integer {
23 size_t length;
24 void *data;
25 int negative;
26} heim_integer;
27
28typedef char *heim_general_string;
29
30typedef char *heim_utf8_string;
31
32typedef struct heim_base_data heim_printable_string;
33
34typedef struct heim_base_data heim_ia5_string;
35
36typedef struct heim_bmp_string {
37 size_t length;
38 uint16_t *data;
39} heim_bmp_string;
40
41typedef struct heim_universal_string {
42 size_t length;
43 uint32_t *data;
44} heim_universal_string;
45
46typedef char *heim_visible_string;
47
48typedef struct heim_oid {
49 size_t length;
50 unsigned *components;
51} heim_oid;
52
53typedef struct heim_bit_string {
54 size_t length;
55 void *data;
56} heim_bit_string;
57
58typedef struct heim_base_data heim_any;
59typedef struct heim_base_data heim_any_set;
60
61#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \
62 do { \
63 (BL) = length_##T((S)); \
64 (B) = malloc((BL)); \
65 if((B) == NULL) { \
66 (R) = ENOMEM; \
67 } else { \
68 (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
69 (S), (L)); \
70 if((R) != 0) { \
71 free((B)); \
72 (B) = NULL; \
73 } \
74 } \
75 } while (0)
76
77#ifdef _WIN32
78#ifndef ASN1_LIB
79#define ASN1EXP __declspec(dllimport)
80#else
81#define ASN1EXP
82#endif
83#define ASN1CALL __stdcall
84#else
85#define ASN1EXP
86#define ASN1CALL
87#endif
88struct units;
89
90#endif
91
92#include <krb5/rfc2459_asn1.h>
93#include <krb5/heim_asn1.h>
94/* OBJECT IDENTIFIER id-pkcs7 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) } */
95extern ASN1EXP const heim_oid asn1_oid_id_pkcs7;
96#define ASN1_OID_ID_PKCS7 (&asn1_oid_id_pkcs7)
97
98/* OBJECT IDENTIFIER id-pkcs7-data ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(1) } */
99extern ASN1EXP const heim_oid asn1_oid_id_pkcs7_data;
100#define ASN1_OID_ID_PKCS7_DATA (&asn1_oid_id_pkcs7_data)
101
102/* OBJECT IDENTIFIER id-pkcs7-signedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(2) } */
103extern ASN1EXP const heim_oid asn1_oid_id_pkcs7_signedData;
104#define ASN1_OID_ID_PKCS7_SIGNEDDATA (&asn1_oid_id_pkcs7_signedData)
105
106/* OBJECT IDENTIFIER id-pkcs7-envelopedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(3) } */
107extern ASN1EXP const heim_oid asn1_oid_id_pkcs7_envelopedData;
108#define ASN1_OID_ID_PKCS7_ENVELOPEDDATA (&asn1_oid_id_pkcs7_envelopedData)
109
110/* OBJECT IDENTIFIER id-pkcs7-signedAndEnvelopedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(4) } */
111extern ASN1EXP const heim_oid asn1_oid_id_pkcs7_signedAndEnvelopedData;
112#define ASN1_OID_ID_PKCS7_SIGNEDANDENVELOPEDDATA (&asn1_oid_id_pkcs7_signedAndEnvelopedData)
113
114/* OBJECT IDENTIFIER id-pkcs7-digestedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(5) } */
115extern ASN1EXP const heim_oid asn1_oid_id_pkcs7_digestedData;
116#define ASN1_OID_ID_PKCS7_DIGESTEDDATA (&asn1_oid_id_pkcs7_digestedData)
117
118/* OBJECT IDENTIFIER id-pkcs7-encryptedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(6) } */
119extern ASN1EXP const heim_oid asn1_oid_id_pkcs7_encryptedData;
120#define ASN1_OID_ID_PKCS7_ENCRYPTEDDATA (&asn1_oid_id_pkcs7_encryptedData)
121
122/*
123CMSVersion ::= INTEGER {
124 CMSVersion_v0(0),
125 CMSVersion_v1(1),
126 CMSVersion_v2(2),
127 CMSVersion_v3(3),
128 CMSVersion_v4(4)
129}
130*/
131
132typedef enum CMSVersion {
133 CMSVersion_v0 = 0,
134 CMSVersion_v1 = 1,
135 CMSVersion_v2 = 2,
136 CMSVersion_v3 = 3,
137 CMSVersion_v4 = 4
138} CMSVersion;
139
140ASN1EXP int ASN1CALL decode_CMSVersion(const unsigned char *, size_t, CMSVersion *, size_t *);
141ASN1EXP int ASN1CALL encode_CMSVersion(unsigned char *, size_t, const CMSVersion *, size_t *);
142ASN1EXP size_t ASN1CALL length_CMSVersion(const CMSVersion *);
143ASN1EXP int ASN1CALL copy_CMSVersion (const CMSVersion *, CMSVersion *);
144ASN1EXP void ASN1CALL free_CMSVersion (CMSVersion *);
145
146
147/*
148DigestAlgorithmIdentifier ::= AlgorithmIdentifier
149*/
150
151typedef AlgorithmIdentifier DigestAlgorithmIdentifier;
152
153ASN1EXP int ASN1CALL decode_DigestAlgorithmIdentifier(const unsigned char *, size_t, DigestAlgorithmIdentifier *, size_t *);
154ASN1EXP int ASN1CALL encode_DigestAlgorithmIdentifier(unsigned char *, size_t, const DigestAlgorithmIdentifier *, size_t *);
155ASN1EXP size_t ASN1CALL length_DigestAlgorithmIdentifier(const DigestAlgorithmIdentifier *);
156ASN1EXP int ASN1CALL copy_DigestAlgorithmIdentifier (const DigestAlgorithmIdentifier *, DigestAlgorithmIdentifier *);
157ASN1EXP void ASN1CALL free_DigestAlgorithmIdentifier (DigestAlgorithmIdentifier *);
158
159
160/*
161DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
162*/
163
164typedef struct DigestAlgorithmIdentifiers {
165 unsigned int len;
166 DigestAlgorithmIdentifier *val;
167} DigestAlgorithmIdentifiers;
168
169ASN1EXP int ASN1CALL add_DigestAlgorithmIdentifiers (DigestAlgorithmIdentifiers *, const DigestAlgorithmIdentifier *);
170ASN1EXP int ASN1CALL remove_DigestAlgorithmIdentifiers (DigestAlgorithmIdentifiers *, unsigned int);
171ASN1EXP int ASN1CALL decode_DigestAlgorithmIdentifiers(const unsigned char *, size_t, DigestAlgorithmIdentifiers *, size_t *);
172ASN1EXP int ASN1CALL encode_DigestAlgorithmIdentifiers(unsigned char *, size_t, const DigestAlgorithmIdentifiers *, size_t *);
173ASN1EXP size_t ASN1CALL length_DigestAlgorithmIdentifiers(const DigestAlgorithmIdentifiers *);
174ASN1EXP int ASN1CALL copy_DigestAlgorithmIdentifiers (const DigestAlgorithmIdentifiers *, DigestAlgorithmIdentifiers *);
175ASN1EXP void ASN1CALL free_DigestAlgorithmIdentifiers (DigestAlgorithmIdentifiers *);
176
177
178/*
179SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
180*/
181
182typedef AlgorithmIdentifier SignatureAlgorithmIdentifier;
183
184ASN1EXP int ASN1CALL decode_SignatureAlgorithmIdentifier(const unsigned char *, size_t, SignatureAlgorithmIdentifier *, size_t *);
185ASN1EXP int ASN1CALL encode_SignatureAlgorithmIdentifier(unsigned char *, size_t, const SignatureAlgorithmIdentifier *, size_t *);
186ASN1EXP size_t ASN1CALL length_SignatureAlgorithmIdentifier(const SignatureAlgorithmIdentifier *);
187ASN1EXP int ASN1CALL copy_SignatureAlgorithmIdentifier (const SignatureAlgorithmIdentifier *, SignatureAlgorithmIdentifier *);
188ASN1EXP void ASN1CALL free_SignatureAlgorithmIdentifier (SignatureAlgorithmIdentifier *);
189
190
191/*
192ContentType ::= OBJECT IDENTIFIER
193*/
194
195typedef heim_oid ContentType;
196
197ASN1EXP int ASN1CALL decode_ContentType(const unsigned char *, size_t, ContentType *, size_t *);
198ASN1EXP int ASN1CALL encode_ContentType(unsigned char *, size_t, const ContentType *, size_t *);
199ASN1EXP size_t ASN1CALL length_ContentType(const ContentType *);
200ASN1EXP int ASN1CALL copy_ContentType (const ContentType *, ContentType *);
201ASN1EXP void ASN1CALL free_ContentType (ContentType *);
202
203
204/*
205MessageDigest ::= OCTET STRING
206*/
207
208typedef heim_octet_string MessageDigest;
209
210ASN1EXP int ASN1CALL decode_MessageDigest(const unsigned char *, size_t, MessageDigest *, size_t *);
211ASN1EXP int ASN1CALL encode_MessageDigest(unsigned char *, size_t, const MessageDigest *, size_t *);
212ASN1EXP size_t ASN1CALL length_MessageDigest(const MessageDigest *);
213ASN1EXP int ASN1CALL copy_MessageDigest (const MessageDigest *, MessageDigest *);
214ASN1EXP void ASN1CALL free_MessageDigest (MessageDigest *);
215
216
217/*
218ContentInfo ::= SEQUENCE {
219 contentType ContentType,
220 content [0] heim_any OPTIONAL,
221}
222*/
223
224typedef struct ContentInfo {
225 ContentType contentType;
226 heim_any *content;
227} ContentInfo;
228
229ASN1EXP int ASN1CALL decode_ContentInfo(const unsigned char *, size_t, ContentInfo *, size_t *);
230ASN1EXP int ASN1CALL encode_ContentInfo(unsigned char *, size_t, const ContentInfo *, size_t *);
231ASN1EXP size_t ASN1CALL length_ContentInfo(const ContentInfo *);
232ASN1EXP int ASN1CALL copy_ContentInfo (const ContentInfo *, ContentInfo *);
233ASN1EXP void ASN1CALL free_ContentInfo (ContentInfo *);
234
235
236/*
237EncapsulatedContentInfo ::= SEQUENCE {
238 eContentType ContentType,
239 eContent [0] OCTET STRING OPTIONAL,
240}
241*/
242
243typedef struct EncapsulatedContentInfo {
244 ContentType eContentType;
245 heim_octet_string *eContent;
246} EncapsulatedContentInfo;
247
248ASN1EXP int ASN1CALL decode_EncapsulatedContentInfo(const unsigned char *, size_t, EncapsulatedContentInfo *, size_t *);
249ASN1EXP int ASN1CALL encode_EncapsulatedContentInfo(unsigned char *, size_t, const EncapsulatedContentInfo *, size_t *);
250ASN1EXP size_t ASN1CALL length_EncapsulatedContentInfo(const EncapsulatedContentInfo *);
251ASN1EXP int ASN1CALL copy_EncapsulatedContentInfo (const EncapsulatedContentInfo *, EncapsulatedContentInfo *);
252ASN1EXP void ASN1CALL free_EncapsulatedContentInfo (EncapsulatedContentInfo *);
253
254
255/*
256CertificateSet ::= SET OF heim_any
257*/
258
259typedef struct CertificateSet {
260 unsigned int len;
261 heim_any *val;
262} CertificateSet;
263
264ASN1EXP int ASN1CALL decode_CertificateSet(const unsigned char *, size_t, CertificateSet *, size_t *);
265ASN1EXP int ASN1CALL encode_CertificateSet(unsigned char *, size_t, const CertificateSet *, size_t *);
266ASN1EXP size_t ASN1CALL length_CertificateSet(const CertificateSet *);
267ASN1EXP int ASN1CALL copy_CertificateSet (const CertificateSet *, CertificateSet *);
268ASN1EXP void ASN1CALL free_CertificateSet (CertificateSet *);
269
270
271/*
272CertificateList ::= Certificate
273*/
274
275typedef Certificate CertificateList;
276
277ASN1EXP int ASN1CALL decode_CertificateList(const unsigned char *, size_t, CertificateList *, size_t *);
278ASN1EXP int ASN1CALL encode_CertificateList(unsigned char *, size_t, const CertificateList *, size_t *);
279ASN1EXP size_t ASN1CALL length_CertificateList(const CertificateList *);
280ASN1EXP int ASN1CALL copy_CertificateList (const CertificateList *, CertificateList *);
281ASN1EXP void ASN1CALL free_CertificateList (CertificateList *);
282
283
284/*
285CertificateRevocationLists ::= SET OF CertificateList
286*/
287
288typedef struct CertificateRevocationLists {
289 unsigned int len;
290 CertificateList *val;
291} CertificateRevocationLists;
292
293ASN1EXP int ASN1CALL decode_CertificateRevocationLists(const unsigned char *, size_t, CertificateRevocationLists *, size_t *);
294ASN1EXP int ASN1CALL encode_CertificateRevocationLists(unsigned char *, size_t, const CertificateRevocationLists *, size_t *);
295ASN1EXP size_t ASN1CALL length_CertificateRevocationLists(const CertificateRevocationLists *);
296ASN1EXP int ASN1CALL copy_CertificateRevocationLists (const CertificateRevocationLists *, CertificateRevocationLists *);
297ASN1EXP void ASN1CALL free_CertificateRevocationLists (CertificateRevocationLists *);
298
299
300/*
301IssuerAndSerialNumber ::= SEQUENCE {
302 issuer Name,
303 serialNumber CertificateSerialNumber,
304}
305*/
306
307typedef struct IssuerAndSerialNumber {
308 Name issuer;
309 CertificateSerialNumber serialNumber;
310} IssuerAndSerialNumber;
311
312ASN1EXP int ASN1CALL decode_IssuerAndSerialNumber(const unsigned char *, size_t, IssuerAndSerialNumber *, size_t *);
313ASN1EXP int ASN1CALL encode_IssuerAndSerialNumber(unsigned char *, size_t, const IssuerAndSerialNumber *, size_t *);
314ASN1EXP size_t ASN1CALL length_IssuerAndSerialNumber(const IssuerAndSerialNumber *);
315ASN1EXP int ASN1CALL copy_IssuerAndSerialNumber (const IssuerAndSerialNumber *, IssuerAndSerialNumber *);
316ASN1EXP void ASN1CALL free_IssuerAndSerialNumber (IssuerAndSerialNumber *);
317
318
319/*
320CMSIdentifier ::= CHOICE {
321 issuerAndSerialNumber IssuerAndSerialNumber,
322 subjectKeyIdentifier [0] SubjectKeyIdentifier,
323}
324*/
325
326typedef struct CMSIdentifier {
327 enum CMSIdentifier_enum {
328 choice_CMSIdentifier_issuerAndSerialNumber = 1,
329 choice_CMSIdentifier_subjectKeyIdentifier
330 } element;
331 union {
332 IssuerAndSerialNumber issuerAndSerialNumber;
333 SubjectKeyIdentifier subjectKeyIdentifier;
334 } u;
335} CMSIdentifier;
336
337ASN1EXP int ASN1CALL decode_CMSIdentifier(const unsigned char *, size_t, CMSIdentifier *, size_t *);
338ASN1EXP int ASN1CALL encode_CMSIdentifier(unsigned char *, size_t, const CMSIdentifier *, size_t *);
339ASN1EXP size_t ASN1CALL length_CMSIdentifier(const CMSIdentifier *);
340ASN1EXP int ASN1CALL copy_CMSIdentifier (const CMSIdentifier *, CMSIdentifier *);
341ASN1EXP void ASN1CALL free_CMSIdentifier (CMSIdentifier *);
342
343
344/*
345SignerIdentifier ::= CMSIdentifier
346*/
347
348typedef CMSIdentifier SignerIdentifier;
349
350ASN1EXP int ASN1CALL decode_SignerIdentifier(const unsigned char *, size_t, SignerIdentifier *, size_t *);
351ASN1EXP int ASN1CALL encode_SignerIdentifier(unsigned char *, size_t, const SignerIdentifier *, size_t *);
352ASN1EXP size_t ASN1CALL length_SignerIdentifier(const SignerIdentifier *);
353ASN1EXP int ASN1CALL copy_SignerIdentifier (const SignerIdentifier *, SignerIdentifier *);
354ASN1EXP void ASN1CALL free_SignerIdentifier (SignerIdentifier *);
355
356
357/*
358RecipientIdentifier ::= CMSIdentifier
359*/
360
361typedef CMSIdentifier RecipientIdentifier;
362
363ASN1EXP int ASN1CALL decode_RecipientIdentifier(const unsigned char *, size_t, RecipientIdentifier *, size_t *);
364ASN1EXP int ASN1CALL encode_RecipientIdentifier(unsigned char *, size_t, const RecipientIdentifier *, size_t *);
365ASN1EXP size_t ASN1CALL length_RecipientIdentifier(const RecipientIdentifier *);
366ASN1EXP int ASN1CALL copy_RecipientIdentifier (const RecipientIdentifier *, RecipientIdentifier *);
367ASN1EXP void ASN1CALL free_RecipientIdentifier (RecipientIdentifier *);
368
369
370/*
371CMSAttributes ::= SET OF Attribute
372*/
373
374typedef struct CMSAttributes {
375 unsigned int len;
376 Attribute *val;
377} CMSAttributes;
378
379ASN1EXP int ASN1CALL decode_CMSAttributes(const unsigned char *, size_t, CMSAttributes *, size_t *);
380ASN1EXP int ASN1CALL encode_CMSAttributes(unsigned char *, size_t, const CMSAttributes *, size_t *);
381ASN1EXP size_t ASN1CALL length_CMSAttributes(const CMSAttributes *);
382ASN1EXP int ASN1CALL copy_CMSAttributes (const CMSAttributes *, CMSAttributes *);
383ASN1EXP void ASN1CALL free_CMSAttributes (CMSAttributes *);
384
385
386/*
387SignatureValue ::= OCTET STRING
388*/
389
390typedef heim_octet_string SignatureValue;
391
392ASN1EXP int ASN1CALL decode_SignatureValue(const unsigned char *, size_t, SignatureValue *, size_t *);
393ASN1EXP int ASN1CALL encode_SignatureValue(unsigned char *, size_t, const SignatureValue *, size_t *);
394ASN1EXP size_t ASN1CALL length_SignatureValue(const SignatureValue *);
395ASN1EXP int ASN1CALL copy_SignatureValue (const SignatureValue *, SignatureValue *);
396ASN1EXP void ASN1CALL free_SignatureValue (SignatureValue *);
397
398
399/*
400SignerInfo ::= SEQUENCE {
401 version CMSVersion,
402 sid SignerIdentifier,
403 digestAlgorithm DigestAlgorithmIdentifier,
404 signedAttrs [0] IMPLICIT SET OF Attribute OPTIONAL,
405 signatureAlgorithm SignatureAlgorithmIdentifier,
406 signature SignatureValue,
407 unsignedAttrs [1] IMPLICIT SET OF Attribute OPTIONAL,
408}
409*/
410
411typedef struct SignerInfo {
412 CMSVersion version;
413 SignerIdentifier sid;
414 DigestAlgorithmIdentifier digestAlgorithm;
415 struct SignerInfo_signedAttrs {
416 unsigned int len;
417 Attribute *val;
418 } *signedAttrs;
419 SignatureAlgorithmIdentifier signatureAlgorithm;
420 SignatureValue signature;
421 struct SignerInfo_unsignedAttrs {
422 unsigned int len;
423 Attribute *val;
424 } *unsignedAttrs;
425} SignerInfo;
426
427ASN1EXP int ASN1CALL decode_SignerInfo(const unsigned char *, size_t, SignerInfo *, size_t *);
428ASN1EXP int ASN1CALL encode_SignerInfo(unsigned char *, size_t, const SignerInfo *, size_t *);
429ASN1EXP size_t ASN1CALL length_SignerInfo(const SignerInfo *);
430ASN1EXP int ASN1CALL copy_SignerInfo (const SignerInfo *, SignerInfo *);
431ASN1EXP void ASN1CALL free_SignerInfo (SignerInfo *);
432
433
434/*
435SignerInfos ::= SET OF SignerInfo
436*/
437
438typedef struct SignerInfos {
439 unsigned int len;
440 SignerInfo *val;
441} SignerInfos;
442
443ASN1EXP int ASN1CALL decode_SignerInfos(const unsigned char *, size_t, SignerInfos *, size_t *);
444ASN1EXP int ASN1CALL encode_SignerInfos(unsigned char *, size_t, const SignerInfos *, size_t *);
445ASN1EXP size_t ASN1CALL length_SignerInfos(const SignerInfos *);
446ASN1EXP int ASN1CALL copy_SignerInfos (const SignerInfos *, SignerInfos *);
447ASN1EXP void ASN1CALL free_SignerInfos (SignerInfos *);
448
449
450/*
451SignedData ::= SEQUENCE {
452 version CMSVersion,
453 digestAlgorithms DigestAlgorithmIdentifiers,
454 encapContentInfo EncapsulatedContentInfo,
455 certificates [0] IMPLICIT SET OF heim_any OPTIONAL,
456 crls [1] IMPLICIT heim_any OPTIONAL,
457 signerInfos SignerInfos,
458}
459*/
460
461typedef struct SignedData {
462 CMSVersion version;
463 DigestAlgorithmIdentifiers digestAlgorithms;
464 EncapsulatedContentInfo encapContentInfo;
465 struct SignedData_certificates {
466 unsigned int len;
467 heim_any *val;
468 } *certificates;
469 heim_any *crls;
470 SignerInfos signerInfos;
471} SignedData;
472
473ASN1EXP int ASN1CALL decode_SignedData(const unsigned char *, size_t, SignedData *, size_t *);
474ASN1EXP int ASN1CALL encode_SignedData(unsigned char *, size_t, const SignedData *, size_t *);
475ASN1EXP size_t ASN1CALL length_SignedData(const SignedData *);
476ASN1EXP int ASN1CALL copy_SignedData (const SignedData *, SignedData *);
477ASN1EXP void ASN1CALL free_SignedData (SignedData *);
478
479
480/*
481OriginatorInfo ::= SEQUENCE {
482 certs [0] IMPLICIT SET OF heim_any OPTIONAL,
483 crls [1] IMPLICIT heim_any OPTIONAL,
484}
485*/
486
487typedef struct OriginatorInfo {
488 struct OriginatorInfo_certs {
489 unsigned int len;
490 heim_any *val;
491 } *certs;
492 heim_any *crls;
493} OriginatorInfo;
494
495ASN1EXP int ASN1CALL decode_OriginatorInfo(const unsigned char *, size_t, OriginatorInfo *, size_t *);
496ASN1EXP int ASN1CALL encode_OriginatorInfo(unsigned char *, size_t, const OriginatorInfo *, size_t *);
497ASN1EXP size_t ASN1CALL length_OriginatorInfo(const OriginatorInfo *);
498ASN1EXP int ASN1CALL copy_OriginatorInfo (const OriginatorInfo *, OriginatorInfo *);
499ASN1EXP void ASN1CALL free_OriginatorInfo (OriginatorInfo *);
500
501
502/*
503KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
504*/
505
506typedef AlgorithmIdentifier KeyEncryptionAlgorithmIdentifier;
507
508ASN1EXP int ASN1CALL decode_KeyEncryptionAlgorithmIdentifier(const unsigned char *, size_t, KeyEncryptionAlgorithmIdentifier *, size_t *);
509ASN1EXP int ASN1CALL encode_KeyEncryptionAlgorithmIdentifier(unsigned char *, size_t, const KeyEncryptionAlgorithmIdentifier *, size_t *);
510ASN1EXP size_t ASN1CALL length_KeyEncryptionAlgorithmIdentifier(const KeyEncryptionAlgorithmIdentifier *);
511ASN1EXP int ASN1CALL copy_KeyEncryptionAlgorithmIdentifier (const KeyEncryptionAlgorithmIdentifier *, KeyEncryptionAlgorithmIdentifier *);
512ASN1EXP void ASN1CALL free_KeyEncryptionAlgorithmIdentifier (KeyEncryptionAlgorithmIdentifier *);
513
514
515/*
516ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
517*/
518
519typedef AlgorithmIdentifier ContentEncryptionAlgorithmIdentifier;
520
521ASN1EXP int ASN1CALL decode_ContentEncryptionAlgorithmIdentifier(const unsigned char *, size_t, ContentEncryptionAlgorithmIdentifier *, size_t *);
522ASN1EXP int ASN1CALL encode_ContentEncryptionAlgorithmIdentifier(unsigned char *, size_t, const ContentEncryptionAlgorithmIdentifier *, size_t *);
523ASN1EXP size_t ASN1CALL length_ContentEncryptionAlgorithmIdentifier(const ContentEncryptionAlgorithmIdentifier *);
524ASN1EXP int ASN1CALL copy_ContentEncryptionAlgorithmIdentifier (const ContentEncryptionAlgorithmIdentifier *, ContentEncryptionAlgorithmIdentifier *);
525ASN1EXP void ASN1CALL free_ContentEncryptionAlgorithmIdentifier (ContentEncryptionAlgorithmIdentifier *);
526
527
528/*
529EncryptedKey ::= OCTET STRING
530*/
531
532typedef heim_octet_string EncryptedKey;
533
534ASN1EXP int ASN1CALL decode_EncryptedKey(const unsigned char *, size_t, EncryptedKey *, size_t *);
535ASN1EXP int ASN1CALL encode_EncryptedKey(unsigned char *, size_t, const EncryptedKey *, size_t *);
536ASN1EXP size_t ASN1CALL length_EncryptedKey(const EncryptedKey *);
537ASN1EXP int ASN1CALL copy_EncryptedKey (const EncryptedKey *, EncryptedKey *);
538ASN1EXP void ASN1CALL free_EncryptedKey (EncryptedKey *);
539
540
541/*
542KeyTransRecipientInfo ::= SEQUENCE {
543 version CMSVersion,
544 rid RecipientIdentifier,
545 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
546 encryptedKey EncryptedKey,
547}
548*/
549
550typedef struct KeyTransRecipientInfo {
551 CMSVersion version;
552 RecipientIdentifier rid;
553 KeyEncryptionAlgorithmIdentifier keyEncryptionAlgorithm;
554 EncryptedKey encryptedKey;
555} KeyTransRecipientInfo;
556
557ASN1EXP int ASN1CALL decode_KeyTransRecipientInfo(const unsigned char *, size_t, KeyTransRecipientInfo *, size_t *);
558ASN1EXP int ASN1CALL encode_KeyTransRecipientInfo(unsigned char *, size_t, const KeyTransRecipientInfo *, size_t *);
559ASN1EXP size_t ASN1CALL length_KeyTransRecipientInfo(const KeyTransRecipientInfo *);
560ASN1EXP int ASN1CALL copy_KeyTransRecipientInfo (const KeyTransRecipientInfo *, KeyTransRecipientInfo *);
561ASN1EXP void ASN1CALL free_KeyTransRecipientInfo (KeyTransRecipientInfo *);
562
563
564/*
565RecipientInfo ::= KeyTransRecipientInfo
566*/
567
568typedef KeyTransRecipientInfo RecipientInfo;
569
570ASN1EXP int ASN1CALL decode_RecipientInfo(const unsigned char *, size_t, RecipientInfo *, size_t *);
571ASN1EXP int ASN1CALL encode_RecipientInfo(unsigned char *, size_t, const RecipientInfo *, size_t *);
572ASN1EXP size_t ASN1CALL length_RecipientInfo(const RecipientInfo *);
573ASN1EXP int ASN1CALL copy_RecipientInfo (const RecipientInfo *, RecipientInfo *);
574ASN1EXP void ASN1CALL free_RecipientInfo (RecipientInfo *);
575
576
577/*
578RecipientInfos ::= SET OF RecipientInfo
579*/
580
581typedef struct RecipientInfos {
582 unsigned int len;
583 RecipientInfo *val;
584} RecipientInfos;
585
586ASN1EXP int ASN1CALL decode_RecipientInfos(const unsigned char *, size_t, RecipientInfos *, size_t *);
587ASN1EXP int ASN1CALL encode_RecipientInfos(unsigned char *, size_t, const RecipientInfos *, size_t *);
588ASN1EXP size_t ASN1CALL length_RecipientInfos(const RecipientInfos *);
589ASN1EXP int ASN1CALL copy_RecipientInfos (const RecipientInfos *, RecipientInfos *);
590ASN1EXP void ASN1CALL free_RecipientInfos (RecipientInfos *);
591
592
593/*
594EncryptedContent ::= OCTET STRING
595*/
596
597typedef heim_octet_string EncryptedContent;
598
599ASN1EXP int ASN1CALL decode_EncryptedContent(const unsigned char *, size_t, EncryptedContent *, size_t *);
600ASN1EXP int ASN1CALL encode_EncryptedContent(unsigned char *, size_t, const EncryptedContent *, size_t *);
601ASN1EXP size_t ASN1CALL length_EncryptedContent(const EncryptedContent *);
602ASN1EXP int ASN1CALL copy_EncryptedContent (const EncryptedContent *, EncryptedContent *);
603ASN1EXP void ASN1CALL free_EncryptedContent (EncryptedContent *);
604
605
606/*
607EncryptedContentInfo ::= SEQUENCE {
608 contentType ContentType,
609 contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
610 encryptedContent [0] IMPLICIT OCTET STRING OPTIONAL,
611}
612*/
613
614typedef struct EncryptedContentInfo {
615 ContentType contentType;
616 ContentEncryptionAlgorithmIdentifier contentEncryptionAlgorithm;
617 heim_octet_string *encryptedContent;
618} EncryptedContentInfo;
619
620ASN1EXP int ASN1CALL decode_EncryptedContentInfo(const unsigned char *, size_t, EncryptedContentInfo *, size_t *);
621ASN1EXP int ASN1CALL encode_EncryptedContentInfo(unsigned char *, size_t, const EncryptedContentInfo *, size_t *);
622ASN1EXP size_t ASN1CALL length_EncryptedContentInfo(const EncryptedContentInfo *);
623ASN1EXP int ASN1CALL copy_EncryptedContentInfo (const EncryptedContentInfo *, EncryptedContentInfo *);
624ASN1EXP void ASN1CALL free_EncryptedContentInfo (EncryptedContentInfo *);
625
626
627/*
628UnprotectedAttributes ::= SET OF Attribute
629*/
630
631typedef struct UnprotectedAttributes {
632 unsigned int len;
633 Attribute *val;
634} UnprotectedAttributes;
635
636ASN1EXP int ASN1CALL decode_UnprotectedAttributes(const unsigned char *, size_t, UnprotectedAttributes *, size_t *);
637ASN1EXP int ASN1CALL encode_UnprotectedAttributes(unsigned char *, size_t, const UnprotectedAttributes *, size_t *);
638ASN1EXP size_t ASN1CALL length_UnprotectedAttributes(const UnprotectedAttributes *);
639ASN1EXP int ASN1CALL copy_UnprotectedAttributes (const UnprotectedAttributes *, UnprotectedAttributes *);
640ASN1EXP void ASN1CALL free_UnprotectedAttributes (UnprotectedAttributes *);
641
642
643/*
644CMSEncryptedData ::= SEQUENCE {
645 version CMSVersion,
646 encryptedContentInfo EncryptedContentInfo,
647 unprotectedAttrs [1] IMPLICIT heim_any OPTIONAL,
648}
649*/
650
651typedef struct CMSEncryptedData {
652 CMSVersion version;
653 EncryptedContentInfo encryptedContentInfo;
654 heim_any *unprotectedAttrs;
655} CMSEncryptedData;
656
657ASN1EXP int ASN1CALL decode_CMSEncryptedData(const unsigned char *, size_t, CMSEncryptedData *, size_t *);
658ASN1EXP int ASN1CALL encode_CMSEncryptedData(unsigned char *, size_t, const CMSEncryptedData *, size_t *);
659ASN1EXP size_t ASN1CALL length_CMSEncryptedData(const CMSEncryptedData *);
660ASN1EXP int ASN1CALL copy_CMSEncryptedData (const CMSEncryptedData *, CMSEncryptedData *);
661ASN1EXP void ASN1CALL free_CMSEncryptedData (CMSEncryptedData *);
662
663
664/*
665EnvelopedData ::= SEQUENCE {
666 version CMSVersion,
667 originatorInfo [0] IMPLICIT heim_any OPTIONAL,
668 recipientInfos RecipientInfos,
669 encryptedContentInfo EncryptedContentInfo,
670 unprotectedAttrs [1] IMPLICIT heim_any OPTIONAL,
671}
672*/
673
674typedef struct EnvelopedData {
675 CMSVersion version;
676 heim_any *originatorInfo;
677 RecipientInfos recipientInfos;
678 EncryptedContentInfo encryptedContentInfo;
679 heim_any *unprotectedAttrs;
680} EnvelopedData;
681
682ASN1EXP int ASN1CALL decode_EnvelopedData(const unsigned char *, size_t, EnvelopedData *, size_t *);
683ASN1EXP int ASN1CALL encode_EnvelopedData(unsigned char *, size_t, const EnvelopedData *, size_t *);
684ASN1EXP size_t ASN1CALL length_EnvelopedData(const EnvelopedData *);
685ASN1EXP int ASN1CALL copy_EnvelopedData (const EnvelopedData *, EnvelopedData *);
686ASN1EXP void ASN1CALL free_EnvelopedData (EnvelopedData *);
687
688
689/*
690CMSRC2CBCParameter ::= SEQUENCE {
691 rc2ParameterVersion INTEGER (0..4294967295),
692 iv OCTET STRING,
693}
694*/
695
696typedef struct CMSRC2CBCParameter {
697 unsigned int rc2ParameterVersion;
698 heim_octet_string iv;
699} CMSRC2CBCParameter;
700
701ASN1EXP int ASN1CALL decode_CMSRC2CBCParameter(const unsigned char *, size_t, CMSRC2CBCParameter *, size_t *);
702ASN1EXP int ASN1CALL encode_CMSRC2CBCParameter(unsigned char *, size_t, const CMSRC2CBCParameter *, size_t *);
703ASN1EXP size_t ASN1CALL length_CMSRC2CBCParameter(const CMSRC2CBCParameter *);
704ASN1EXP int ASN1CALL copy_CMSRC2CBCParameter (const CMSRC2CBCParameter *, CMSRC2CBCParameter *);
705ASN1EXP void ASN1CALL free_CMSRC2CBCParameter (CMSRC2CBCParameter *);
706
707
708/*
709CMSCBCParameter ::= OCTET STRING
710*/
711
712typedef heim_octet_string CMSCBCParameter;
713
714ASN1EXP int ASN1CALL decode_CMSCBCParameter(const unsigned char *, size_t, CMSCBCParameter *, size_t *);
715ASN1EXP int ASN1CALL encode_CMSCBCParameter(unsigned char *, size_t, const CMSCBCParameter *, size_t *);
716ASN1EXP size_t ASN1CALL length_CMSCBCParameter(const CMSCBCParameter *);
717ASN1EXP int ASN1CALL copy_CMSCBCParameter (const CMSCBCParameter *, CMSCBCParameter *);
718ASN1EXP void ASN1CALL free_CMSCBCParameter (CMSCBCParameter *);
719
720
721#endif /* __cms_asn1_h__ */
722