]> git.saurik.com Git - apple/security.git/blob - SecurityASN1/inc/sm_cms.h
Security-54.1.3.tar.gz
[apple/security.git] / SecurityASN1 / inc / sm_cms.h
1 // NOTE: this is a machine generated file--editing not recommended
2 //
3 // sm_cms.h - class definitions for ASN.1 module CryptographicMessageSyntax
4 //
5 // This file was generated by snacc on Mon Apr 22 22:34:19 2002
6 // UBC snacc by Mike Sample
7 // A couple of enhancements made by IBM European Networking Center
8
9 #ifndef _sm_cms_h_
10 #define _sm_cms_h_
11
12
13 //------------------------------------------------------------------------------
14 // class declarations:
15
16 class CMSVersion;
17 class OriginatorPublicKey;
18 class CertificateRevocationLists;
19 class IssuerAndSerialNumber;
20 class OtherKeyAttribute;
21 class DigestAlgorithmIdentifiers;
22 class EncapsulatedContentInfo;
23 class SignerIdentifier;
24 class EncryptedContentInfo;
25 class RecipientIdentifier;
26 class OriginatorIdentifierOrKey;
27 class RecipientKeyIdentifier;
28 class KEKIdentifier;
29 class ExtendedCertificateInfo;
30 class SignerInfo;
31 class KeyTransRecipientInfo;
32 class KeyAgreeRecipientIdentifier;
33 class KEKRecipientInfo;
34 class ExtendedCertificate;
35 class SignerInfos;
36 class RecipientEncryptedKey;
37 class CertificateChoices;
38 class CertificateSet;
39 class OriginatorInfo;
40 class RecipientEncryptedKeys;
41 class KeyAgreeRecipientInfo;
42 class RecipientInfo;
43 class RecipientInfos;
44 class ContentInfo;
45 class SignedData;
46 class EnvelopedData;
47 class DigestedData;
48 class EncryptedData;
49 class AuthenticatedData;
50 class UserKeyingMaterials;
51 class RC2CBCParameter;
52 class ExtendedCertificateOrCertificate;
53 class DigestInfo;
54
55 //------------------------------------------------------------------------------
56 // class definitions:
57
58 typedef enum CryptographicMessageSyntaxAnyId
59 {
60
61 } CryptographicMessageSyntaxAnyId;
62
63
64 /* OBJECT IDENTIFIER */
65 typedef AsnOid ContentType;
66
67 /* OCTET STRING */
68 typedef AsnOcts SignatureValue;
69
70 /* OCTET STRING */
71 typedef AsnOcts EncryptedContent;
72
73 /* OCTET STRING */
74 typedef AsnOcts EncryptedKey;
75
76 /* OCTET STRING */
77 typedef AsnOcts Digest;
78
79 /* OCTET STRING */
80 typedef AsnOcts MessageAuthenticationCode;
81
82 /* INTEGER { v0 (0), v1 (1), v2 (2), v3 (3), v4 (4) } */
83 class CMSVersion: public AsnInt
84 {
85 public:
86 CMSVersion(): AsnInt() {}
87 CMSVersion (int i): AsnInt (i) {}
88 enum
89 {
90 v0 = 0,
91 v1 = 1,
92 v2 = 2,
93 v3 = 3,
94 v4 = 4
95 };
96 };
97
98
99 /* OCTET STRING */
100 typedef AsnOcts UserKeyingMaterial;
101
102 /* OCTET STRING */
103 typedef AsnOcts MessageDigest;
104
105 /* INTEGER */
106 typedef AsnInt RC2ParameterVersion;
107
108 /* OCTET STRING */
109 typedef AsnOcts IV;
110
111 /* BIT STRING */
112 typedef AsnBits Signature;
113
114 class OriginatorPublicKey: public AsnType
115 {
116 public:
117 AlgorithmIdentifier *algorithm;
118 AsnBits publicKey;
119
120 OriginatorPublicKey();
121 OriginatorPublicKey (const OriginatorPublicKey &);
122 virtual ~OriginatorPublicKey();
123 virtual AsnType *Clone() const;
124
125 virtual AsnType *Copy() const;
126
127 OriginatorPublicKey &operator = (const OriginatorPublicKey &);
128 AsnLen BEncContent (BUF_TYPE b);
129 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
130
131 AsnLen BEnc (BUF_TYPE b);
132 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
133 void Print (ostream &os) const;
134 };
135
136
137 /* AlgorithmIdentifier */
138 typedef AlgorithmIdentifier DigestAlgorithmIdentifier;
139
140 /* AlgorithmIdentifier */
141 typedef AlgorithmIdentifier SignatureAlgorithmIdentifier;
142
143 /* AlgorithmIdentifier */
144 typedef AlgorithmIdentifier KeyEncryptionAlgorithmIdentifier;
145
146 /* AlgorithmIdentifier */
147 typedef AlgorithmIdentifier ContentEncryptionAlgorithmIdentifier;
148
149 /* AlgorithmIdentifier */
150 typedef AlgorithmIdentifier MessageAuthenticationCodeAlgorithm;
151
152 class CertificateRevocationLists: public AsnType
153 {
154 protected:
155 unsigned long int count;
156 struct AsnListElmt
157 {
158 AsnListElmt *next;
159 AsnListElmt *prev;
160 CertificateList *elmt;
161 } *first, *curr, *last;
162
163 public:
164 CertificateRevocationLists() { count = 0; first = curr = last = NULL; }
165 CertificateRevocationLists (const CertificateRevocationLists &);
166 virtual ~CertificateRevocationLists();
167 virtual AsnType *Clone() const;
168
169 virtual AsnType *Copy() const;
170
171 CertificateRevocationLists &operator = (const CertificateRevocationLists &);
172 void SetCurrElmt (unsigned long int index);
173 unsigned long int GetCurrElmtIndex();
174 void SetCurrToFirst() { curr = first; }
175 void SetCurrToLast() { curr = last; }
176 // reading member fcns
177 int Count() const { return count; }
178 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
179 CertificateList *First() const { return count > 0 ? first->elmt : NULL; }
180 CertificateList *Last() const { return count > 0 ? last->elmt : NULL; }
181 CertificateList *Curr() const { return curr ? curr->elmt : NULL; }
182 CertificateList *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
183 CertificateList *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
184
185 // routines that move the curr elmt
186 CertificateList *GoNext() { if (curr) curr = curr->next; return Curr(); }
187 CertificateList *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
188
189 // write & alloc fcns - returns new elmt
190 CertificateList *Append(); // add elmt to end of list
191 CertificateList *Prepend(); // add elmt to beginning of list
192 CertificateList *InsertBefore(); //insert elmt before current elmt
193 CertificateList *InsertAfter(); //insert elmt after current elmt
194
195 // write & alloc & copy - returns list after copying elmt
196 CertificateRevocationLists &AppendCopy (CertificateList &elmt); // add elmt to end of list
197 CertificateRevocationLists &PrependCopy (CertificateList &elmt); // add elmt to beginning of list
198 CertificateRevocationLists &InsertBeforeAndCopy (CertificateList &elmt); //insert elmt before current elmt
199 CertificateRevocationLists &InsertAfterAndCopy (CertificateList &elmt); //insert elmt after current elmt
200
201 // removing the current elmt from the list
202 void RemoveCurrFromList();
203
204 // encode and decode routines
205 AsnLen BEnc (BUF_TYPE b);
206 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
207 AsnLen BEncContent (BUF_TYPE b);
208 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
209
210 PDU_MEMBER_MACROS
211 void Print (ostream &os) const;
212 };
213
214
215 class IssuerAndSerialNumber: public AsnType
216 {
217 public:
218 Name *issuer;
219 CertificateSerialNumber serialNumber;
220
221 IssuerAndSerialNumber();
222 IssuerAndSerialNumber (const IssuerAndSerialNumber &);
223 virtual ~IssuerAndSerialNumber();
224 virtual AsnType *Clone() const;
225
226 virtual AsnType *Copy() const;
227
228 IssuerAndSerialNumber &operator = (const IssuerAndSerialNumber &);
229 AsnLen BEncContent (BUF_TYPE b);
230 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
231
232 AsnLen BEnc (BUF_TYPE b);
233 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
234 void Print (ostream &os) const;
235 };
236
237
238 class OtherKeyAttribute: public AsnType
239 {
240 public:
241 AsnOid keyAttrId;
242 AsnAny *keyAttr;
243
244 OtherKeyAttribute();
245 OtherKeyAttribute (const OtherKeyAttribute &);
246 virtual ~OtherKeyAttribute();
247 virtual AsnType *Clone() const;
248
249 virtual AsnType *Copy() const;
250
251 OtherKeyAttribute &operator = (const OtherKeyAttribute &);
252 AsnLen BEncContent (BUF_TYPE b);
253 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
254
255 AsnLen BEnc (BUF_TYPE b);
256 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
257 void Print (ostream &os) const;
258 };
259
260
261 class DigestAlgorithmIdentifiers: public AsnType
262 {
263 protected:
264 unsigned long int count;
265 struct AsnListElmt
266 {
267 AsnListElmt *next;
268 AsnListElmt *prev;
269 DigestAlgorithmIdentifier *elmt;
270 } *first, *curr, *last;
271
272 public:
273 DigestAlgorithmIdentifiers() { count = 0; first = curr = last = NULL; }
274 DigestAlgorithmIdentifiers (const DigestAlgorithmIdentifiers &);
275 virtual ~DigestAlgorithmIdentifiers();
276 virtual AsnType *Clone() const;
277
278 virtual AsnType *Copy() const;
279
280 DigestAlgorithmIdentifiers &operator = (const DigestAlgorithmIdentifiers &);
281 void SetCurrElmt (unsigned long int index);
282 unsigned long int GetCurrElmtIndex();
283 void SetCurrToFirst() { curr = first; }
284 void SetCurrToLast() { curr = last; }
285 // reading member fcns
286 int Count() const { return count; }
287 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
288 DigestAlgorithmIdentifier *First() const { return count > 0 ? first->elmt : NULL; }
289 DigestAlgorithmIdentifier *Last() const { return count > 0 ? last->elmt : NULL; }
290 DigestAlgorithmIdentifier *Curr() const { return curr ? curr->elmt : NULL; }
291 DigestAlgorithmIdentifier *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
292 DigestAlgorithmIdentifier *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
293
294 // routines that move the curr elmt
295 DigestAlgorithmIdentifier *GoNext() { if (curr) curr = curr->next; return Curr(); }
296 DigestAlgorithmIdentifier *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
297
298 // write & alloc fcns - returns new elmt
299 DigestAlgorithmIdentifier *Append(); // add elmt to end of list
300 DigestAlgorithmIdentifier *Prepend(); // add elmt to beginning of list
301 DigestAlgorithmIdentifier *InsertBefore(); //insert elmt before current elmt
302 DigestAlgorithmIdentifier *InsertAfter(); //insert elmt after current elmt
303
304 // write & alloc & copy - returns list after copying elmt
305 DigestAlgorithmIdentifiers &AppendCopy (DigestAlgorithmIdentifier &elmt); // add elmt to end of list
306 DigestAlgorithmIdentifiers &PrependCopy (DigestAlgorithmIdentifier &elmt); // add elmt to beginning of list
307 DigestAlgorithmIdentifiers &InsertBeforeAndCopy (DigestAlgorithmIdentifier &elmt); //insert elmt before current elmt
308 DigestAlgorithmIdentifiers &InsertAfterAndCopy (DigestAlgorithmIdentifier &elmt); //insert elmt after current elmt
309
310 // removing the current elmt from the list
311 void RemoveCurrFromList();
312
313 // encode and decode routines
314 AsnLen BEnc (BUF_TYPE b);
315 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
316 AsnLen BEncContent (BUF_TYPE b);
317 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
318
319 PDU_MEMBER_MACROS
320 void Print (ostream &os) const;
321 };
322
323
324 class EncapsulatedContentInfo: public AsnType
325 {
326 public:
327 ContentType eContentType;
328 AsnOcts *eContent;
329
330 EncapsulatedContentInfo();
331 EncapsulatedContentInfo (const EncapsulatedContentInfo &);
332 virtual ~EncapsulatedContentInfo();
333 virtual AsnType *Clone() const;
334
335 virtual AsnType *Copy() const;
336
337 EncapsulatedContentInfo &operator = (const EncapsulatedContentInfo &);
338 AsnLen BEncContent (BUF_TYPE b);
339 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
340
341 AsnLen BEnc (BUF_TYPE b);
342 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
343 void Print (ostream &os) const;
344 };
345
346
347 class SignerIdentifier: public AsnType
348 {
349 public:
350 enum ChoiceIdEnum
351 {
352 issuerAndSerialNumberCid = 0,
353 subjectKeyIdentifierCid = 1
354 };
355
356 enum ChoiceIdEnum choiceId;
357 union
358 {
359 IssuerAndSerialNumber *issuerAndSerialNumber;
360 KeyIdentifier *subjectKeyIdentifier;
361 };
362
363
364 SignerIdentifier();
365 SignerIdentifier (const SignerIdentifier &);
366 virtual ~SignerIdentifier();
367
368 virtual AsnType *Clone() const;
369
370 virtual AsnType *Copy() const;
371
372 SignerIdentifier &operator = (const SignerIdentifier &);
373 AsnLen BEncContent (BUF_TYPE b);
374 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
375 AsnLen BEnc (BUF_TYPE b);
376 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
377 void Print (ostream &os) const;
378 };
379
380
381 class EncryptedContentInfo: public AsnType
382 {
383 public:
384 ContentType contentType;
385 ContentEncryptionAlgorithmIdentifier *contentEncryptionAlgorithm;
386 EncryptedContent *encryptedContent;
387
388 EncryptedContentInfo();
389 EncryptedContentInfo (const EncryptedContentInfo &);
390 virtual ~EncryptedContentInfo();
391 virtual AsnType *Clone() const;
392
393 virtual AsnType *Copy() const;
394
395 EncryptedContentInfo &operator = (const EncryptedContentInfo &);
396 AsnLen BEncContent (BUF_TYPE b);
397 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
398
399 AsnLen BEnc (BUF_TYPE b);
400 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
401 void Print (ostream &os) const;
402 };
403
404
405 class RecipientIdentifier: public AsnType
406 {
407 public:
408 enum ChoiceIdEnum
409 {
410 issuerAndSerialNumberCid = 0,
411 subjectKeyIdentifierCid = 1
412 };
413
414 enum ChoiceIdEnum choiceId;
415 union
416 {
417 IssuerAndSerialNumber *issuerAndSerialNumber;
418 KeyIdentifier *subjectKeyIdentifier;
419 };
420
421
422 RecipientIdentifier();
423 RecipientIdentifier (const RecipientIdentifier &);
424 virtual ~RecipientIdentifier();
425
426 virtual AsnType *Clone() const;
427
428 virtual AsnType *Copy() const;
429
430 RecipientIdentifier &operator = (const RecipientIdentifier &);
431 AsnLen BEncContent (BUF_TYPE b);
432 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
433 AsnLen BEnc (BUF_TYPE b);
434 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
435 void Print (ostream &os) const;
436 };
437
438
439 class OriginatorIdentifierOrKey: public AsnType
440 {
441 public:
442 enum ChoiceIdEnum
443 {
444 issuerAndSerialNumberCid = 0,
445 subjectKeyIdentifierCid = 1,
446 originatorKeyCid = 2
447 };
448
449 enum ChoiceIdEnum choiceId;
450 union
451 {
452 IssuerAndSerialNumber *issuerAndSerialNumber;
453 KeyIdentifier *subjectKeyIdentifier;
454 OriginatorPublicKey *originatorKey;
455 };
456
457
458 OriginatorIdentifierOrKey();
459 OriginatorIdentifierOrKey (const OriginatorIdentifierOrKey &);
460 virtual ~OriginatorIdentifierOrKey();
461
462 virtual AsnType *Clone() const;
463
464 virtual AsnType *Copy() const;
465
466 OriginatorIdentifierOrKey &operator = (const OriginatorIdentifierOrKey &);
467 AsnLen BEncContent (BUF_TYPE b);
468 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
469 AsnLen BEnc (BUF_TYPE b);
470 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
471 void Print (ostream &os) const;
472 };
473
474
475 class RecipientKeyIdentifier: public AsnType
476 {
477 public:
478 KeyIdentifier subjectKeyIdentifier;
479 GeneralizedTime *date;
480 OtherKeyAttribute *other;
481
482 RecipientKeyIdentifier();
483 RecipientKeyIdentifier (const RecipientKeyIdentifier &);
484 virtual ~RecipientKeyIdentifier();
485 virtual AsnType *Clone() const;
486
487 virtual AsnType *Copy() const;
488
489 RecipientKeyIdentifier &operator = (const RecipientKeyIdentifier &);
490 AsnLen BEncContent (BUF_TYPE b);
491 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
492
493 AsnLen BEnc (BUF_TYPE b);
494 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
495 void Print (ostream &os) const;
496 };
497
498
499 class KEKIdentifier: public AsnType
500 {
501 public:
502 AsnOcts keyIdentifier;
503 GeneralizedTime *date;
504 OtherKeyAttribute *other;
505
506 KEKIdentifier();
507 KEKIdentifier (const KEKIdentifier &);
508 virtual ~KEKIdentifier();
509 virtual AsnType *Clone() const;
510
511 virtual AsnType *Copy() const;
512
513 KEKIdentifier &operator = (const KEKIdentifier &);
514 AsnLen BEncContent (BUF_TYPE b);
515 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
516
517 AsnLen BEnc (BUF_TYPE b);
518 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
519 void Print (ostream &os) const;
520 };
521
522
523 class ExtendedCertificateInfo: public AsnType
524 {
525 public:
526 CMSVersion version;
527 Certificate *certificate;
528 Attributes attributes;
529
530 ExtendedCertificateInfo();
531 ExtendedCertificateInfo (const ExtendedCertificateInfo &);
532 virtual ~ExtendedCertificateInfo();
533 virtual AsnType *Clone() const;
534
535 virtual AsnType *Copy() const;
536
537 ExtendedCertificateInfo &operator = (const ExtendedCertificateInfo &);
538 AsnLen BEncContent (BUF_TYPE b);
539 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
540
541 AsnLen BEnc (BUF_TYPE b);
542 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
543 void Print (ostream &os) const;
544 };
545
546
547 class SignerInfo: public AsnType
548 {
549 public:
550 CMSVersion version;
551 SignerIdentifier *sid;
552 DigestAlgorithmIdentifier *digestAlgorithm;
553 Attributes *signedAttrs;
554 SignatureAlgorithmIdentifier *signatureAlgorithm;
555 SignatureValue signature;
556 Attributes *unsignedAttrs;
557
558 SignerInfo();
559 SignerInfo (const SignerInfo &);
560 virtual ~SignerInfo();
561 virtual AsnType *Clone() const;
562
563 virtual AsnType *Copy() const;
564
565 SignerInfo &operator = (const SignerInfo &);
566 AsnLen BEncContent (BUF_TYPE b);
567 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
568
569 AsnLen BEnc (BUF_TYPE b);
570 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
571 void Print (ostream &os) const;
572 };
573
574
575 class KeyTransRecipientInfo: public AsnType
576 {
577 public:
578 CMSVersion version;
579 RecipientIdentifier *rid;
580 KeyEncryptionAlgorithmIdentifier *keyEncryptionAlgorithm;
581 EncryptedKey encryptedKey;
582
583 KeyTransRecipientInfo();
584 KeyTransRecipientInfo (const KeyTransRecipientInfo &);
585 virtual ~KeyTransRecipientInfo();
586 virtual AsnType *Clone() const;
587
588 virtual AsnType *Copy() const;
589
590 KeyTransRecipientInfo &operator = (const KeyTransRecipientInfo &);
591 AsnLen BEncContent (BUF_TYPE b);
592 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
593
594 AsnLen BEnc (BUF_TYPE b);
595 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
596 void Print (ostream &os) const;
597 };
598
599
600 class KeyAgreeRecipientIdentifier: public AsnType
601 {
602 public:
603 enum ChoiceIdEnum
604 {
605 issuerAndSerialNumberCid = 0,
606 rKeyIdCid = 1
607 };
608
609 enum ChoiceIdEnum choiceId;
610 union
611 {
612 IssuerAndSerialNumber *issuerAndSerialNumber;
613 RecipientKeyIdentifier *rKeyId;
614 };
615
616
617 KeyAgreeRecipientIdentifier();
618 KeyAgreeRecipientIdentifier (const KeyAgreeRecipientIdentifier &);
619 virtual ~KeyAgreeRecipientIdentifier();
620
621 virtual AsnType *Clone() const;
622
623 virtual AsnType *Copy() const;
624
625 KeyAgreeRecipientIdentifier &operator = (const KeyAgreeRecipientIdentifier &);
626 AsnLen BEncContent (BUF_TYPE b);
627 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
628 AsnLen BEnc (BUF_TYPE b);
629 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
630 void Print (ostream &os) const;
631 };
632
633
634 class KEKRecipientInfo: public AsnType
635 {
636 public:
637 CMSVersion version;
638 KEKIdentifier *kekid;
639 KeyEncryptionAlgorithmIdentifier *keyEncryptionAlgorithm;
640 EncryptedKey encryptedKey;
641
642 KEKRecipientInfo();
643 KEKRecipientInfo (const KEKRecipientInfo &);
644 virtual ~KEKRecipientInfo();
645 virtual AsnType *Clone() const;
646
647 virtual AsnType *Copy() const;
648
649 KEKRecipientInfo &operator = (const KEKRecipientInfo &);
650 AsnLen BEncContent (BUF_TYPE b);
651 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
652
653 AsnLen BEnc (BUF_TYPE b);
654 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
655 void Print (ostream &os) const;
656 };
657
658
659 class ExtendedCertificate: public AsnType
660 {
661 public:
662 ExtendedCertificateInfo *extendedCertificateInfo;
663 SignatureAlgorithmIdentifier *signatureAlgorithm;
664 Signature signature;
665
666 ExtendedCertificate();
667 ExtendedCertificate (const ExtendedCertificate &);
668 virtual ~ExtendedCertificate();
669 virtual AsnType *Clone() const;
670
671 virtual AsnType *Copy() const;
672
673 ExtendedCertificate &operator = (const ExtendedCertificate &);
674 AsnLen BEncContent (BUF_TYPE b);
675 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
676
677 AsnLen BEnc (BUF_TYPE b);
678 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
679 void Print (ostream &os) const;
680 };
681
682
683 class SignerInfos: public AsnType
684 {
685 protected:
686 unsigned long int count;
687 struct AsnListElmt
688 {
689 AsnListElmt *next;
690 AsnListElmt *prev;
691 SignerInfo *elmt;
692 } *first, *curr, *last;
693
694 public:
695 SignerInfos() { count = 0; first = curr = last = NULL; }
696 SignerInfos (const SignerInfos &);
697 virtual ~SignerInfos();
698 virtual AsnType *Clone() const;
699
700 virtual AsnType *Copy() const;
701
702 SignerInfos &operator = (const SignerInfos &);
703 void SetCurrElmt (unsigned long int index);
704 unsigned long int GetCurrElmtIndex();
705 void SetCurrToFirst() { curr = first; }
706 void SetCurrToLast() { curr = last; }
707 // reading member fcns
708 int Count() const { return count; }
709 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
710 SignerInfo *First() const { return count > 0 ? first->elmt : NULL; }
711 SignerInfo *Last() const { return count > 0 ? last->elmt : NULL; }
712 SignerInfo *Curr() const { return curr ? curr->elmt : NULL; }
713 SignerInfo *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
714 SignerInfo *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
715
716 // routines that move the curr elmt
717 SignerInfo *GoNext() { if (curr) curr = curr->next; return Curr(); }
718 SignerInfo *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
719
720 // write & alloc fcns - returns new elmt
721 SignerInfo *Append(); // add elmt to end of list
722 SignerInfo *Prepend(); // add elmt to beginning of list
723 SignerInfo *InsertBefore(); //insert elmt before current elmt
724 SignerInfo *InsertAfter(); //insert elmt after current elmt
725
726 // write & alloc & copy - returns list after copying elmt
727 SignerInfos &AppendCopy (SignerInfo &elmt); // add elmt to end of list
728 SignerInfos &PrependCopy (SignerInfo &elmt); // add elmt to beginning of list
729 SignerInfos &InsertBeforeAndCopy (SignerInfo &elmt); //insert elmt before current elmt
730 SignerInfos &InsertAfterAndCopy (SignerInfo &elmt); //insert elmt after current elmt
731
732 // removing the current elmt from the list
733 void RemoveCurrFromList();
734
735 // encode and decode routines
736 AsnLen BEnc (BUF_TYPE b);
737 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
738 AsnLen BEncContent (BUF_TYPE b);
739 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
740
741 PDU_MEMBER_MACROS
742 void Print (ostream &os) const;
743 };
744
745
746 class RecipientEncryptedKey: public AsnType
747 {
748 public:
749 KeyAgreeRecipientIdentifier *rid;
750 EncryptedKey encryptedKey;
751
752 RecipientEncryptedKey();
753 RecipientEncryptedKey (const RecipientEncryptedKey &);
754 virtual ~RecipientEncryptedKey();
755 virtual AsnType *Clone() const;
756
757 virtual AsnType *Copy() const;
758
759 RecipientEncryptedKey &operator = (const RecipientEncryptedKey &);
760 AsnLen BEncContent (BUF_TYPE b);
761 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
762
763 AsnLen BEnc (BUF_TYPE b);
764 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
765 void Print (ostream &os) const;
766 };
767
768
769 class CertificateChoices: public AsnType
770 {
771 public:
772 enum ChoiceIdEnum
773 {
774 certificateCid = 0,
775 extendedCertificateCid = 1,
776 attrCertCid = 2
777 };
778
779 enum ChoiceIdEnum choiceId;
780 union
781 {
782 Certificate *certificate;
783 ExtendedCertificate *extendedCertificate;
784 AttributeCertificate *attrCert;
785 };
786
787
788 CertificateChoices();
789 CertificateChoices (const CertificateChoices &);
790 virtual ~CertificateChoices();
791
792 virtual AsnType *Clone() const;
793
794 virtual AsnType *Copy() const;
795
796 CertificateChoices &operator = (const CertificateChoices &);
797 AsnLen BEncContent (BUF_TYPE b);
798 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
799 AsnLen BEnc (BUF_TYPE b);
800 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
801 void Print (ostream &os) const;
802 };
803
804
805 class CertificateSet: public AsnType
806 {
807 protected:
808 unsigned long int count;
809 struct AsnListElmt
810 {
811 AsnListElmt *next;
812 AsnListElmt *prev;
813 CertificateChoices *elmt;
814 } *first, *curr, *last;
815
816 public:
817 CertificateSet() { count = 0; first = curr = last = NULL; }
818 CertificateSet (const CertificateSet &);
819 virtual ~CertificateSet();
820 virtual AsnType *Clone() const;
821
822 virtual AsnType *Copy() const;
823
824 CertificateSet &operator = (const CertificateSet &);
825 void SetCurrElmt (unsigned long int index);
826 unsigned long int GetCurrElmtIndex();
827 void SetCurrToFirst() { curr = first; }
828 void SetCurrToLast() { curr = last; }
829 // reading member fcns
830 int Count() const { return count; }
831 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
832 CertificateChoices *First() const { return count > 0 ? first->elmt : NULL; }
833 CertificateChoices *Last() const { return count > 0 ? last->elmt : NULL; }
834 CertificateChoices *Curr() const { return curr ? curr->elmt : NULL; }
835 CertificateChoices *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
836 CertificateChoices *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
837
838 // routines that move the curr elmt
839 CertificateChoices *GoNext() { if (curr) curr = curr->next; return Curr(); }
840 CertificateChoices *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
841
842 // write & alloc fcns - returns new elmt
843 CertificateChoices *Append(); // add elmt to end of list
844 CertificateChoices *Prepend(); // add elmt to beginning of list
845 CertificateChoices *InsertBefore(); //insert elmt before current elmt
846 CertificateChoices *InsertAfter(); //insert elmt after current elmt
847
848 // write & alloc & copy - returns list after copying elmt
849 CertificateSet &AppendCopy (CertificateChoices &elmt); // add elmt to end of list
850 CertificateSet &PrependCopy (CertificateChoices &elmt); // add elmt to beginning of list
851 CertificateSet &InsertBeforeAndCopy (CertificateChoices &elmt); //insert elmt before current elmt
852 CertificateSet &InsertAfterAndCopy (CertificateChoices &elmt); //insert elmt after current elmt
853
854 // removing the current elmt from the list
855 void RemoveCurrFromList();
856
857 // encode and decode routines
858 AsnLen BEnc (BUF_TYPE b);
859 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
860 AsnLen BEncContent (BUF_TYPE b);
861 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
862
863 PDU_MEMBER_MACROS
864 void Print (ostream &os) const;
865 };
866
867
868 class OriginatorInfo: public AsnType
869 {
870 public:
871 CertificateSet *certs;
872 CertificateRevocationLists *crls;
873
874 OriginatorInfo();
875 OriginatorInfo (const OriginatorInfo &);
876 virtual ~OriginatorInfo();
877 virtual AsnType *Clone() const;
878
879 virtual AsnType *Copy() const;
880
881 OriginatorInfo &operator = (const OriginatorInfo &);
882 AsnLen BEncContent (BUF_TYPE b);
883 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
884
885 AsnLen BEnc (BUF_TYPE b);
886 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
887 void Print (ostream &os) const;
888 };
889
890
891 class RecipientEncryptedKeys: public AsnType
892 {
893 protected:
894 unsigned long int count;
895 struct AsnListElmt
896 {
897 AsnListElmt *next;
898 AsnListElmt *prev;
899 RecipientEncryptedKey *elmt;
900 } *first, *curr, *last;
901
902 public:
903 RecipientEncryptedKeys() { count = 0; first = curr = last = NULL; }
904 RecipientEncryptedKeys (const RecipientEncryptedKeys &);
905 virtual ~RecipientEncryptedKeys();
906 virtual AsnType *Clone() const;
907
908 virtual AsnType *Copy() const;
909
910 RecipientEncryptedKeys &operator = (const RecipientEncryptedKeys &);
911 void SetCurrElmt (unsigned long int index);
912 unsigned long int GetCurrElmtIndex();
913 void SetCurrToFirst() { curr = first; }
914 void SetCurrToLast() { curr = last; }
915 // reading member fcns
916 int Count() const { return count; }
917 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
918 RecipientEncryptedKey *First() const { return count > 0 ? first->elmt : NULL; }
919 RecipientEncryptedKey *Last() const { return count > 0 ? last->elmt : NULL; }
920 RecipientEncryptedKey *Curr() const { return curr ? curr->elmt : NULL; }
921 RecipientEncryptedKey *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
922 RecipientEncryptedKey *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
923
924 // routines that move the curr elmt
925 RecipientEncryptedKey *GoNext() { if (curr) curr = curr->next; return Curr(); }
926 RecipientEncryptedKey *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
927
928 // write & alloc fcns - returns new elmt
929 RecipientEncryptedKey *Append(); // add elmt to end of list
930 RecipientEncryptedKey *Prepend(); // add elmt to beginning of list
931 RecipientEncryptedKey *InsertBefore(); //insert elmt before current elmt
932 RecipientEncryptedKey *InsertAfter(); //insert elmt after current elmt
933
934 // write & alloc & copy - returns list after copying elmt
935 RecipientEncryptedKeys &AppendCopy (RecipientEncryptedKey &elmt); // add elmt to end of list
936 RecipientEncryptedKeys &PrependCopy (RecipientEncryptedKey &elmt); // add elmt to beginning of list
937 RecipientEncryptedKeys &InsertBeforeAndCopy (RecipientEncryptedKey &elmt); //insert elmt before current elmt
938 RecipientEncryptedKeys &InsertAfterAndCopy (RecipientEncryptedKey &elmt); //insert elmt after current elmt
939
940 // removing the current elmt from the list
941 void RemoveCurrFromList();
942
943 // encode and decode routines
944 AsnLen BEnc (BUF_TYPE b);
945 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
946 AsnLen BEncContent (BUF_TYPE b);
947 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
948
949 PDU_MEMBER_MACROS
950 void Print (ostream &os) const;
951 };
952
953
954 class KeyAgreeRecipientInfo: public AsnType
955 {
956 public:
957 CMSVersion version;
958 OriginatorIdentifierOrKey *originator;
959 UserKeyingMaterial *ukm;
960 KeyEncryptionAlgorithmIdentifier *keyEncryptionAlgorithm;
961 RecipientEncryptedKeys recipientEncryptedKeys;
962
963 KeyAgreeRecipientInfo();
964 KeyAgreeRecipientInfo (const KeyAgreeRecipientInfo &);
965 virtual ~KeyAgreeRecipientInfo();
966 virtual AsnType *Clone() const;
967
968 virtual AsnType *Copy() const;
969
970 KeyAgreeRecipientInfo &operator = (const KeyAgreeRecipientInfo &);
971 AsnLen BEncContent (BUF_TYPE b);
972 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
973
974 AsnLen BEnc (BUF_TYPE b);
975 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
976 void Print (ostream &os) const;
977 };
978
979
980 class RecipientInfo: public AsnType
981 {
982 public:
983 enum ChoiceIdEnum
984 {
985 ktriCid = 0,
986 kariCid = 1,
987 kekriCid = 2
988 };
989
990 enum ChoiceIdEnum choiceId;
991 union
992 {
993 KeyTransRecipientInfo *ktri;
994 KeyAgreeRecipientInfo *kari;
995 KEKRecipientInfo *kekri;
996 };
997
998
999 RecipientInfo();
1000 RecipientInfo (const RecipientInfo &);
1001 virtual ~RecipientInfo();
1002
1003 virtual AsnType *Clone() const;
1004
1005 virtual AsnType *Copy() const;
1006
1007 RecipientInfo &operator = (const RecipientInfo &);
1008 AsnLen BEncContent (BUF_TYPE b);
1009 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1010 AsnLen BEnc (BUF_TYPE b);
1011 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1012 void Print (ostream &os) const;
1013 };
1014
1015
1016 class RecipientInfos: public AsnType
1017 {
1018 protected:
1019 unsigned long int count;
1020 struct AsnListElmt
1021 {
1022 AsnListElmt *next;
1023 AsnListElmt *prev;
1024 RecipientInfo *elmt;
1025 } *first, *curr, *last;
1026
1027 public:
1028 RecipientInfos() { count = 0; first = curr = last = NULL; }
1029 RecipientInfos (const RecipientInfos &);
1030 virtual ~RecipientInfos();
1031 virtual AsnType *Clone() const;
1032
1033 virtual AsnType *Copy() const;
1034
1035 RecipientInfos &operator = (const RecipientInfos &);
1036 void SetCurrElmt (unsigned long int index);
1037 unsigned long int GetCurrElmtIndex();
1038 void SetCurrToFirst() { curr = first; }
1039 void SetCurrToLast() { curr = last; }
1040 // reading member fcns
1041 int Count() const { return count; }
1042 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
1043 RecipientInfo *First() const { return count > 0 ? first->elmt : NULL; }
1044 RecipientInfo *Last() const { return count > 0 ? last->elmt : NULL; }
1045 RecipientInfo *Curr() const { return curr ? curr->elmt : NULL; }
1046 RecipientInfo *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
1047 RecipientInfo *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
1048
1049 // routines that move the curr elmt
1050 RecipientInfo *GoNext() { if (curr) curr = curr->next; return Curr(); }
1051 RecipientInfo *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
1052
1053 // write & alloc fcns - returns new elmt
1054 RecipientInfo *Append(); // add elmt to end of list
1055 RecipientInfo *Prepend(); // add elmt to beginning of list
1056 RecipientInfo *InsertBefore(); //insert elmt before current elmt
1057 RecipientInfo *InsertAfter(); //insert elmt after current elmt
1058
1059 // write & alloc & copy - returns list after copying elmt
1060 RecipientInfos &AppendCopy (RecipientInfo &elmt); // add elmt to end of list
1061 RecipientInfos &PrependCopy (RecipientInfo &elmt); // add elmt to beginning of list
1062 RecipientInfos &InsertBeforeAndCopy (RecipientInfo &elmt); //insert elmt before current elmt
1063 RecipientInfos &InsertAfterAndCopy (RecipientInfo &elmt); //insert elmt after current elmt
1064
1065 // removing the current elmt from the list
1066 void RemoveCurrFromList();
1067
1068 // encode and decode routines
1069 AsnLen BEnc (BUF_TYPE b);
1070 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1071 AsnLen BEncContent (BUF_TYPE b);
1072 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1073
1074 PDU_MEMBER_MACROS
1075 void Print (ostream &os) const;
1076 };
1077
1078
1079 class ContentInfo: public AsnType
1080 {
1081 public:
1082 ContentType contentType;
1083 AsnAny content;
1084
1085 ContentInfo();
1086 ContentInfo (const ContentInfo &);
1087 virtual ~ContentInfo();
1088 virtual AsnType *Clone() const;
1089
1090 virtual AsnType *Copy() const;
1091
1092 ContentInfo &operator = (const ContentInfo &);
1093 AsnLen BEncContent (BUF_TYPE b);
1094 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1095
1096 AsnLen BEnc (BUF_TYPE b);
1097 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1098 void Print (ostream &os) const;
1099 };
1100
1101
1102 class SignedData: public AsnType
1103 {
1104 public:
1105 CMSVersion version;
1106 DigestAlgorithmIdentifiers digestAlgorithms;
1107 EncapsulatedContentInfo *encapContentInfo;
1108 CertificateSet *certificates;
1109 CertificateRevocationLists *crls;
1110 SignerInfos signerInfos;
1111
1112 SignedData();
1113 SignedData (const SignedData &);
1114 virtual ~SignedData();
1115 virtual AsnType *Clone() const;
1116
1117 virtual AsnType *Copy() const;
1118
1119 SignedData &operator = (const SignedData &);
1120 AsnLen BEncContent (BUF_TYPE b);
1121 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1122
1123 AsnLen BEnc (BUF_TYPE b);
1124 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1125 void Print (ostream &os) const;
1126 };
1127
1128
1129 class EnvelopedData: public AsnType
1130 {
1131 public:
1132 CMSVersion version;
1133 OriginatorInfo *originatorInfo;
1134 RecipientInfos recipientInfos;
1135 EncryptedContentInfo *encryptedContentInfo;
1136 Attributes *unprotectedAttrs;
1137
1138 EnvelopedData();
1139 EnvelopedData (const EnvelopedData &);
1140 virtual ~EnvelopedData();
1141 virtual AsnType *Clone() const;
1142
1143 virtual AsnType *Copy() const;
1144
1145 EnvelopedData &operator = (const EnvelopedData &);
1146 AsnLen BEncContent (BUF_TYPE b);
1147 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1148
1149 AsnLen BEnc (BUF_TYPE b);
1150 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1151 void Print (ostream &os) const;
1152 };
1153
1154
1155 class DigestedData: public AsnType
1156 {
1157 public:
1158 CMSVersion version;
1159 DigestAlgorithmIdentifier *digestAlgorithm;
1160 EncapsulatedContentInfo *encapContentInfo;
1161 Digest digest;
1162
1163 DigestedData();
1164 DigestedData (const DigestedData &);
1165 virtual ~DigestedData();
1166 virtual AsnType *Clone() const;
1167
1168 virtual AsnType *Copy() const;
1169
1170 DigestedData &operator = (const DigestedData &);
1171 AsnLen BEncContent (BUF_TYPE b);
1172 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1173
1174 AsnLen BEnc (BUF_TYPE b);
1175 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1176 void Print (ostream &os) const;
1177 };
1178
1179
1180 class EncryptedData: public AsnType
1181 {
1182 public:
1183 CMSVersion version;
1184 EncryptedContentInfo *encryptedContentInfo;
1185
1186 EncryptedData();
1187 EncryptedData (const EncryptedData &);
1188 virtual ~EncryptedData();
1189 virtual AsnType *Clone() const;
1190
1191 virtual AsnType *Copy() const;
1192
1193 EncryptedData &operator = (const EncryptedData &);
1194 AsnLen BEncContent (BUF_TYPE b);
1195 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1196
1197 AsnLen BEnc (BUF_TYPE b);
1198 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1199 void Print (ostream &os) const;
1200 };
1201
1202
1203 class AuthenticatedData: public AsnType
1204 {
1205 public:
1206 CMSVersion version;
1207 OriginatorInfo *originatorInfo;
1208 RecipientInfos recipientInfos;
1209 MessageAuthenticationCodeAlgorithm *macAlgorithm;
1210 DigestAlgorithmIdentifier *digestAlgorithm;
1211 EncapsulatedContentInfo *encapContentInfo;
1212 Attributes *authenctiatedAttributes;
1213 MessageAuthenticationCode mac;
1214 Attributes *unauthenticatedAttributes;
1215
1216 AuthenticatedData();
1217 AuthenticatedData (const AuthenticatedData &);
1218 virtual ~AuthenticatedData();
1219 virtual AsnType *Clone() const;
1220
1221 virtual AsnType *Copy() const;
1222
1223 AuthenticatedData &operator = (const AuthenticatedData &);
1224 AsnLen BEncContent (BUF_TYPE b);
1225 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1226
1227 AsnLen BEnc (BUF_TYPE b);
1228 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1229 void Print (ostream &os) const;
1230 };
1231
1232
1233 class UserKeyingMaterials: public AsnType
1234 {
1235 protected:
1236 unsigned long int count;
1237 struct AsnListElmt
1238 {
1239 AsnListElmt *next;
1240 AsnListElmt *prev;
1241 UserKeyingMaterial *elmt;
1242 } *first, *curr, *last;
1243
1244 public:
1245 UserKeyingMaterials() { count = 0; first = curr = last = NULL; }
1246 UserKeyingMaterials (const UserKeyingMaterials &);
1247 virtual ~UserKeyingMaterials();
1248 virtual AsnType *Clone() const;
1249
1250 virtual AsnType *Copy() const;
1251
1252 UserKeyingMaterials &operator = (const UserKeyingMaterials &);
1253 void SetCurrElmt (unsigned long int index);
1254 unsigned long int GetCurrElmtIndex();
1255 void SetCurrToFirst() { curr = first; }
1256 void SetCurrToLast() { curr = last; }
1257 // reading member fcns
1258 int Count() const { return count; }
1259 // NOTE: if your compiler complains about these NULLs, its definition of NULL is broken (and you better change it there!)
1260 UserKeyingMaterial *First() const { return count > 0 ? first->elmt : NULL; }
1261 UserKeyingMaterial *Last() const { return count > 0 ? last->elmt : NULL; }
1262 UserKeyingMaterial *Curr() const { return curr ? curr->elmt : NULL; }
1263 UserKeyingMaterial *Next() const { return curr && curr->next ? curr->next->elmt : NULL; }
1264 UserKeyingMaterial *Prev() const { return curr && curr->prev ? curr->prev->elmt : NULL; }
1265
1266 // routines that move the curr elmt
1267 UserKeyingMaterial *GoNext() { if (curr) curr = curr->next; return Curr(); }
1268 UserKeyingMaterial *GoPrev() { if (curr) curr = curr->prev; return Curr(); }
1269
1270 // write & alloc fcns - returns new elmt
1271 UserKeyingMaterial *Append(); // add elmt to end of list
1272 UserKeyingMaterial *Prepend(); // add elmt to beginning of list
1273 UserKeyingMaterial *InsertBefore(); //insert elmt before current elmt
1274 UserKeyingMaterial *InsertAfter(); //insert elmt after current elmt
1275
1276 // write & alloc & copy - returns list after copying elmt
1277 UserKeyingMaterials &AppendCopy (UserKeyingMaterial &elmt); // add elmt to end of list
1278 UserKeyingMaterials &PrependCopy (UserKeyingMaterial &elmt); // add elmt to beginning of list
1279 UserKeyingMaterials &InsertBeforeAndCopy (UserKeyingMaterial &elmt); //insert elmt before current elmt
1280 UserKeyingMaterials &InsertAfterAndCopy (UserKeyingMaterial &elmt); //insert elmt after current elmt
1281
1282 // removing the current elmt from the list
1283 void RemoveCurrFromList();
1284
1285 // encode and decode routines
1286 AsnLen BEnc (BUF_TYPE b);
1287 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1288 AsnLen BEncContent (BUF_TYPE b);
1289 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1290
1291 PDU_MEMBER_MACROS
1292 void Print (ostream &os) const;
1293 };
1294
1295
1296 /* Time */
1297 typedef Time SigningTime;
1298
1299 /* SignerInfo */
1300 typedef SignerInfo Countersignature;
1301
1302 /* AlgorithmIdentifier */
1303 typedef AlgorithmIdentifier KeyWrapAlgorithm;
1304
1305 /* RC2ParameterVersion */
1306 typedef RC2ParameterVersion RC2wrapParameter;
1307
1308 /* IV */
1309 typedef IV CBCParameter;
1310
1311 class RC2CBCParameter: public AsnType
1312 {
1313 public:
1314 AsnInt rc2ParameterVersion;
1315 AsnOcts iv;
1316
1317 RC2CBCParameter();
1318 RC2CBCParameter (const RC2CBCParameter &);
1319 virtual ~RC2CBCParameter();
1320 virtual AsnType *Clone() const;
1321
1322 virtual AsnType *Copy() const;
1323
1324 RC2CBCParameter &operator = (const RC2CBCParameter &);
1325 AsnLen BEncContent (BUF_TYPE b);
1326 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1327
1328 AsnLen BEnc (BUF_TYPE b);
1329 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1330 void Print (ostream &os) const;
1331 };
1332
1333
1334 class ExtendedCertificateOrCertificate: public AsnType
1335 {
1336 public:
1337 enum ChoiceIdEnum
1338 {
1339 certificateCid = 0,
1340 extendedCertificateCid = 1
1341 };
1342
1343 enum ChoiceIdEnum choiceId;
1344 union
1345 {
1346 Certificate *certificate;
1347 ExtendedCertificate *extendedCertificate;
1348 };
1349
1350
1351 ExtendedCertificateOrCertificate();
1352 ExtendedCertificateOrCertificate (const ExtendedCertificateOrCertificate &);
1353 virtual ~ExtendedCertificateOrCertificate();
1354
1355 virtual AsnType *Clone() const;
1356
1357 virtual AsnType *Copy() const;
1358
1359 ExtendedCertificateOrCertificate &operator = (const ExtendedCertificateOrCertificate &);
1360 AsnLen BEncContent (BUF_TYPE b);
1361 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1362 AsnLen BEnc (BUF_TYPE b);
1363 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1364 void Print (ostream &os) const;
1365 };
1366
1367
1368 class DigestInfo: public AsnType
1369 {
1370 public:
1371 DigestAlgorithmIdentifier *digestAlgorithm;
1372 Digest digest;
1373
1374 DigestInfo();
1375 DigestInfo (const DigestInfo &);
1376 virtual ~DigestInfo();
1377 virtual AsnType *Clone() const;
1378
1379 virtual AsnType *Copy() const;
1380
1381 DigestInfo &operator = (const DigestInfo &);
1382 AsnLen BEncContent (BUF_TYPE b);
1383 void BDecContent (BUF_TYPE b, AsnTag tag, AsnLen elmtLen, AsnLen &bytesDecoded, ENV_TYPE env);
1384
1385 AsnLen BEnc (BUF_TYPE b);
1386 void BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env);
1387 void Print (ostream &os) const;
1388 };
1389
1390
1391 //------------------------------------------------------------------------------
1392 // externs for value defs
1393
1394 #define sha_1_arc 1, 3, 14, 3, 2, 26
1395 #define sha_1 AsnOid(sha_1_arc)
1396 #define id_dsa_with_sha1_arc 1, 2, 840, 10040, 4, 3
1397 #define id_dsa_with_sha1 AsnOid(id_dsa_with_sha1_arc)
1398 #define dh_public_number_arc 1, 2, 840, 10046, 2, 1
1399 #define dh_public_number AsnOid(dh_public_number_arc)
1400 #define id_alg_ESDH_arc 1, 2, 840, 113549, 1, 9, 16, 3, 5
1401 #define id_alg_ESDH AsnOid(id_alg_ESDH_arc)
1402 #define id_alg_CMS3DESwrap_arc 1, 2, 840, 113549, 1, 9, 16, 3, 6
1403 #define id_alg_CMS3DESwrap AsnOid(id_alg_CMS3DESwrap_arc)
1404 #define id_alg_CMSRC2wrap_arc 1, 2, 840, 113549, 1, 9, 16, 3, 7
1405 #define id_alg_CMSRC2wrap AsnOid(id_alg_CMSRC2wrap_arc)
1406 #define des_ede3_cbc_arc 1, 2, 840, 113549, 3, 7
1407 #define des_ede3_cbc AsnOid(des_ede3_cbc_arc)
1408 #define rc2_cbc_arc 1, 2, 840, 113549, 3, 2
1409 #define rc2_cbc AsnOid(rc2_cbc_arc)
1410 #define hMAC_SHA1_arc 1, 3, 6, 1, 5, 5, 8, 1, 2
1411 #define hMAC_SHA1 AsnOid(hMAC_SHA1_arc)
1412 #define rc2_ecb_arc 1, 2, 840, 113549, 3, 3
1413 #define rc2_ecb AsnOid(rc2_ecb_arc)
1414 #define rc4_arc 1, 2, 840, 113549, 3, 4
1415 #define rc4 AsnOid(rc4_arc)
1416 #define rc4WithMAC_arc 1, 2, 840, 113549, 3, 5
1417 #define rc4WithMAC AsnOid(rc4WithMAC_arc)
1418 #define desx_CBC_arc 1, 2, 840, 113549, 3, 6
1419 #define desx_CBC AsnOid(desx_CBC_arc)
1420 #define rc5CBC_arc 1, 2, 840, 113549, 3, 8
1421 #define rc5CBC AsnOid(rc5CBC_arc)
1422 #define rc5_CBCPad_arc 1, 2, 840, 113549, 3, 9
1423 #define rc5_CBCPad AsnOid(rc5_CBCPad_arc)
1424 #define desCDMF_arc 1, 2, 840, 113549, 3, 10
1425 #define desCDMF AsnOid(desCDMF_arc)
1426 #define dsa_bsafe_arc 1, 3, 14, 3, 2, 12
1427 #define dsa_bsafe AsnOid(dsa_bsafe_arc)
1428 #define id_data_arc 1, 2, 840, 113549, 1, 7, 1
1429 #define id_data AsnOid(id_data_arc)
1430 #define id_signedData_arc 1, 2, 840, 113549, 1, 7, 2
1431 #define id_signedData AsnOid(id_signedData_arc)
1432 #define id_envelopedData_arc 1, 2, 840, 113549, 1, 7, 3
1433 #define id_envelopedData AsnOid(id_envelopedData_arc)
1434 #define id_digestedData_arc 1, 2, 840, 113549, 1, 7, 5
1435 #define id_digestedData AsnOid(id_digestedData_arc)
1436 #define id_encryptedData_arc 1, 2, 840, 113549, 1, 7, 6
1437 #define id_encryptedData AsnOid(id_encryptedData_arc)
1438 #define id_ct_authData_arc 1, 2, 840, 113549, 1, 9, 16, 1, 2
1439 #define id_ct_authData AsnOid(id_ct_authData_arc)
1440 #define id_contentType_arc 1, 2, 840, 113549, 1, 9, 3
1441 #define id_contentType AsnOid(id_contentType_arc)
1442 #define id_messageDigest_arc 1, 2, 840, 113549, 1, 9, 4
1443 #define id_messageDigest AsnOid(id_messageDigest_arc)
1444 #define id_signingTime_arc 1, 2, 840, 113549, 1, 9, 5
1445 #define id_signingTime AsnOid(id_signingTime_arc)
1446 #define id_countersignature_arc 1, 2, 840, 113549, 1, 9, 6
1447 #define id_countersignature AsnOid(id_countersignature_arc)
1448 #define id_macValue_arc 1, 2, 840, 113549, 1, 9, 16, 2, 8
1449 #define id_macValue AsnOid(id_macValue_arc)
1450 #define id_dsa_arc 1, 2, 840, 10040, 4, 1
1451 #define id_dsa AsnOid(id_dsa_arc)
1452 //------------------------------------------------------------------------------
1453
1454 #endif /* conditional include of sm_cms.h */