Debian Codegraph @

build_helpers/heimdal/include/cms_asn1.h

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