1 // NOTE: this is a machine generated file--editing not recommended
3 // sm_x509af.cpp - class member functions for ASN.1 module AuthenticationFramework
5 // This file was generated by snacc on Mon Apr 22 22:34:19 2002
6 // UBC snacc written by Mike Sample
7 // A couple of enhancements made by IBM European Networking Center
11 #include "sm_vdatypes.h"
12 #include "sm_x501ud.h"
13 #include "sm_x411ub.h"
14 #include "sm_x411mtsas.h"
15 #include "sm_x501if.h"
16 #include "sm_x520sa.h"
17 #include "sm_x509cmn.h"
18 #include "sm_x509af.h"
19 #include "sm_x509ce.h"
20 #include "pkcs1oids.h"
21 #include "pkcs9oids.h"
26 #include "appleoids.h"
29 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
34 // class member definitions:
36 AsnType
*AttributeCertificateAssertionSetOf::Clone() const
38 return new AttributeCertificateAssertionSetOf
;
41 AsnType
*AttributeCertificateAssertionSetOf::Copy() const
43 return new AttributeCertificateAssertionSetOf (*this);
46 AsnLen
AttributeCertificateAssertionSetOf::BEnc (BUF_TYPE b
)
50 l
+= BEncConsLen (b
, l
);
51 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
55 void AttributeCertificateAssertionSetOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
60 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
62 Asn1Error
<< "AttributeCertificateAssertionSetOf::BDec: ERROR - wrong tag" << endl
;
63 SnaccExcep::throwMe(-100);
65 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
66 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
69 AttributeCertificateAssertionSetOf::AttributeCertificateAssertionSetOf (const AttributeCertificateAssertionSetOf
&)
71 Asn1Error
<< "use of incompletely defined AttributeCertificateAssertionSetOf::AttributeCertificateAssertionSetOf (const AttributeCertificateAssertionSetOf &)" << endl
;
75 AttributeCertificateAssertionSetOf::~AttributeCertificateAssertionSetOf()
78 for (; Curr() != NULL
; RemoveCurrFromList())
80 } // end of destructor
83 AttributeCertificateAssertionSetOf
&AttributeCertificateAssertionSetOf::operator = (const AttributeCertificateAssertionSetOf
&that
)
84 #else // SNACC_DEEP_COPY
85 AttributeCertificateAssertionSetOf
&AttributeCertificateAssertionSetOf::operator = (const AttributeCertificateAssertionSetOf
&)
86 #endif // SNACC_DEEP_COPY
92 for (; Curr(); RemoveCurrFromList())
95 //that.SetCurrToFirst();
96 //for (; that.Curr(); that.GoNext())
97 // AppendCopy (*that.Curr());
98 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
99 AppendCopy (*run
->elmt
);
103 #else // SNACC_DEEP_COPY
104 Asn1Error
<< "use of incompletely defined AttributeCertificateAssertionSetOf &AttributeCertificateAssertionSetOf::operator = (const AttributeCertificateAssertionSetOf &)" << endl
;
106 // if your compiler complains here, check the -novolat option
107 #endif // SNACC_DEEP_COPY
110 void AttributeCertificateAssertionSetOf::Print (ostream
&os
) const
113 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
114 indentG
+= stdIndentG
;
116 //for (; Curr() != NULL; GoNext())
117 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
119 Indent (os
, indentG
);
122 //if (Curr() != Last())
127 indentG
-= stdIndentG
;
128 Indent (os
, indentG
);
136 void AttributeCertificateAssertionSetOf::SetCurrElmt (unsigned long int index
)
141 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
143 } // AttributeCertificateAssertionSetOf::SetCurrElmt
146 unsigned long int AttributeCertificateAssertionSetOf::GetCurrElmtIndex()
152 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
161 } // AttributeCertificateAssertionSetOf::GetCurrElmtIndex
164 // alloc new list elmt, put at end of list
165 // and return the component type
166 AttributeType
*AttributeCertificateAssertionSetOf::Append()
168 AsnListElmt
*newElmt
;
169 newElmt
= new AsnListElmt
;
170 newElmt
->elmt
= new AttributeType
;
171 newElmt
->next
= NULL
;
174 newElmt
->prev
= NULL
;
175 first
= last
= newElmt
;
179 newElmt
->prev
= last
;
180 last
->next
= newElmt
;
184 return (curr
= newElmt
)->elmt
;
185 } // AttributeCertificateAssertionSetOf::Append
188 // alloc new list elmt, put at begining of list
189 // and return the component type
190 AttributeType
*AttributeCertificateAssertionSetOf::Prepend()
192 AsnListElmt
*newElmt
;
193 newElmt
= new AsnListElmt
;
194 newElmt
->elmt
= new AttributeType
;
195 newElmt
->prev
= NULL
;
198 newElmt
->next
= NULL
;
199 first
= last
= newElmt
;
203 newElmt
->next
= first
;
204 first
->prev
= newElmt
;
208 return (curr
= newElmt
)->elmt
;
209 } // AttributeCertificateAssertionSetOf::Prepend
212 // alloc new list elmt, insert it before the
213 // current element and return the component type
214 // if the current element is null, the new element
215 // is placed at the beginning of the list.
216 AttributeType
*AttributeCertificateAssertionSetOf::InsertBefore()
218 AsnListElmt
*newElmt
;
219 newElmt
= new AsnListElmt
;
220 newElmt
->elmt
= new AttributeType
;
223 newElmt
->next
= first
;
224 newElmt
->prev
= NULL
;
231 newElmt
->next
= curr
;
232 newElmt
->prev
= curr
->prev
;
233 curr
->prev
= newElmt
;
237 newElmt
->prev
->next
= newElmt
;
240 return (curr
= newElmt
)->elmt
;
241 } // AttributeCertificateAssertionSetOf::InsertBefore
244 // alloc new list elmt, insert it after the
245 // current element and return the component type
246 // if the current element is null, the new element
247 // is placed at the end of the list.
248 AttributeType
*AttributeCertificateAssertionSetOf::InsertAfter()
250 AsnListElmt
*newElmt
;
251 newElmt
= new AsnListElmt
;
252 newElmt
->elmt
= new AttributeType
;
255 newElmt
->prev
= last
;
256 newElmt
->next
= NULL
;
263 newElmt
->prev
= curr
;
264 newElmt
->next
= curr
->next
;
265 curr
->next
= newElmt
;
269 newElmt
->next
->prev
= newElmt
;
272 return (curr
= newElmt
)->elmt
;
273 } // AttributeCertificateAssertionSetOf::InsertAfter
276 AttributeCertificateAssertionSetOf
&AttributeCertificateAssertionSetOf::AppendCopy (AttributeType
&elmt
)
278 AsnListElmt
*newElmt
;
279 newElmt
= new AsnListElmt
;
280 newElmt
->elmt
= new AttributeType
;
281 *newElmt
->elmt
= elmt
;
282 newElmt
->next
= NULL
;
285 newElmt
->prev
= NULL
;
286 first
= last
= newElmt
;
290 newElmt
->prev
= last
;
291 last
->next
= newElmt
;
299 AttributeCertificateAssertionSetOf
&AttributeCertificateAssertionSetOf::PrependCopy (AttributeType
&elmt
)
301 AsnListElmt
*newElmt
;
302 newElmt
= new AsnListElmt
;
303 newElmt
->elmt
= new AttributeType
;
304 *newElmt
->elmt
= elmt
;
305 newElmt
->prev
= NULL
;
308 newElmt
->next
= NULL
;
309 first
= last
= newElmt
;
313 newElmt
->next
= first
;
314 first
->prev
= newElmt
;
319 } // AttributeCertificateAssertionSetOf::PrependCopy
322 // alloc new list elmt, insert it before the
323 // current element, copy the given elmt into the new elmt
324 // and return the component type.
325 // if the current element is null, the new element
326 // is placed at the beginning of the list.
327 AttributeCertificateAssertionSetOf
&AttributeCertificateAssertionSetOf::InsertBeforeAndCopy (AttributeType
&elmt
)
329 AsnListElmt
*newElmt
;
331 newElmt
= new AsnListElmt
;
332 newElmt
->elmt
= new AttributeType
;
333 *newElmt
->elmt
= elmt
;
337 newElmt
->next
= first
;
338 newElmt
->prev
= NULL
;
345 newElmt
->next
= curr
;
346 newElmt
->prev
= curr
->prev
;
347 curr
->prev
= newElmt
;
351 newElmt
->prev
->next
= newElmt
;
355 } // AttributeCertificateAssertionSetOf::InsertBeforeAndCopy
358 // alloc new list elmt, insert it after the
359 // current element, copy given elmt in to new elmt
360 // and return the component type
361 // if the current element is null, the new element
362 // is placed at the end of the list.
363 AttributeCertificateAssertionSetOf
&AttributeCertificateAssertionSetOf::InsertAfterAndCopy (AttributeType
&elmt
)
365 AsnListElmt
*newElmt
;
367 newElmt
= new AsnListElmt
;
368 newElmt
->elmt
= new AttributeType
;
369 *newElmt
->elmt
= elmt
;
372 newElmt
->prev
= last
;
373 newElmt
->next
= NULL
;
380 newElmt
->prev
= curr
;
381 newElmt
->next
= curr
->next
;
382 curr
->next
= newElmt
;
386 newElmt
->next
->prev
= newElmt
;
390 } // AttributeCertificateAssertionSetOf::InsertAfterAndCopy
393 // remove current element from list if current element is not NULL
394 // The new current element will be the next element.
395 // If the current element is the last element in the list
396 // the second but last element will become the new current element.
397 void AttributeCertificateAssertionSetOf::RemoveCurrFromList()
399 AsnListElmt
*del_elmt
;
407 first
= last
= curr
= NULL
;
408 else if (curr
== first
)
410 curr
= first
= first
->next
;
413 else if (curr
== last
)
415 curr
= last
= last
->prev
;
420 curr
->prev
->next
= curr
->next
;
421 curr
->next
->prev
= curr
->prev
;
424 delete del_elmt
->elmt
;
430 AsnLen
AttributeCertificateAssertionSetOf::BEncContent (BUF_TYPE b
)
432 AsnListElmt
*currElmt
;
437 CSM_Buffer
**tmpEnc
=NULL
;
438 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
439 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
440 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
442 ENCODE_BUF1(currElmt
->elmt
->BEncContent
, elmtLen
);
443 elmtLen
+= BEncDefLen (outputBuf
, elmtLen
);
445 elmtLen
+= BEncTag1 (outputBuf
, UNIV
, PRIM
, OID_TAG_CODE
);
446 ENCODE_BUF2(tmpEnc
[iii
]);
448 vdasnacc_sortSetOf(tmpEnc
, icount
);
449 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
450 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
451 for (iii
=0; iii
< icount
; iii
++) delete tmpEnc
[iii
];
456 } // AttributeCertificateAssertionSetOf::BEncContent
459 void AttributeCertificateAssertionSetOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
460 AsnLen
&bytesDecoded
, ENV_TYPE env
)
462 AttributeType
*listElmt
;
464 AsnLen listBytesDecoded
= 0;
467 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
469 tag1
= BDecTag (b
, listBytesDecoded
, env
);
470 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
472 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
475 if ((tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
477 Asn1Error
<< "Unexpected Tag" << endl
;
478 SnaccExcep::throwMe(-101);
481 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
483 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
486 bytesDecoded
+= listBytesDecoded
;
487 } // AttributeCertificateAssertionSetOf::BDecContent
490 AsnType
*AttributeCertificateInfoSeqOf::Clone() const
492 return new AttributeCertificateInfoSeqOf
;
495 AsnType
*AttributeCertificateInfoSeqOf::Copy() const
497 return new AttributeCertificateInfoSeqOf (*this);
500 AsnLen
AttributeCertificateInfoSeqOf::BEnc (BUF_TYPE b
)
504 l
+= BEncConsLen (b
, l
);
505 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
509 void AttributeCertificateInfoSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
514 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
516 Asn1Error
<< "AttributeCertificateInfoSeqOf::BDec: ERROR - wrong tag" << endl
;
517 SnaccExcep::throwMe(-102);
519 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
520 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
523 AttributeCertificateInfoSeqOf::AttributeCertificateInfoSeqOf (const AttributeCertificateInfoSeqOf
&)
525 Asn1Error
<< "use of incompletely defined AttributeCertificateInfoSeqOf::AttributeCertificateInfoSeqOf (const AttributeCertificateInfoSeqOf &)" << endl
;
529 AttributeCertificateInfoSeqOf::~AttributeCertificateInfoSeqOf()
532 for (; Curr() != NULL
; RemoveCurrFromList())
534 } // end of destructor
537 AttributeCertificateInfoSeqOf
&AttributeCertificateInfoSeqOf::operator = (const AttributeCertificateInfoSeqOf
&that
)
538 #else // SNACC_DEEP_COPY
539 AttributeCertificateInfoSeqOf
&AttributeCertificateInfoSeqOf::operator = (const AttributeCertificateInfoSeqOf
&)
540 #endif // SNACC_DEEP_COPY
546 for (; Curr(); RemoveCurrFromList())
549 //that.SetCurrToFirst();
550 //for (; that.Curr(); that.GoNext())
551 // AppendCopy (*that.Curr());
552 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
553 AppendCopy (*run
->elmt
);
557 #else // SNACC_DEEP_COPY
558 Asn1Error
<< "use of incompletely defined AttributeCertificateInfoSeqOf &AttributeCertificateInfoSeqOf::operator = (const AttributeCertificateInfoSeqOf &)" << endl
;
560 // if your compiler complains here, check the -novolat option
561 #endif // SNACC_DEEP_COPY
564 void AttributeCertificateInfoSeqOf::Print (ostream
&os
) const
567 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
568 indentG
+= stdIndentG
;
570 //for (; Curr() != NULL; GoNext())
571 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
573 Indent (os
, indentG
);
576 //if (Curr() != Last())
581 indentG
-= stdIndentG
;
582 Indent (os
, indentG
);
590 void AttributeCertificateInfoSeqOf::SetCurrElmt (unsigned long int index
)
595 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
597 } // AttributeCertificateInfoSeqOf::SetCurrElmt
600 unsigned long int AttributeCertificateInfoSeqOf::GetCurrElmtIndex()
606 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
615 } // AttributeCertificateInfoSeqOf::GetCurrElmtIndex
618 // alloc new list elmt, put at end of list
619 // and return the component type
620 Attribute
*AttributeCertificateInfoSeqOf::Append()
622 AsnListElmt
*newElmt
;
623 newElmt
= new AsnListElmt
;
624 newElmt
->elmt
= new Attribute
;
625 newElmt
->next
= NULL
;
628 newElmt
->prev
= NULL
;
629 first
= last
= newElmt
;
633 newElmt
->prev
= last
;
634 last
->next
= newElmt
;
638 return (curr
= newElmt
)->elmt
;
639 } // AttributeCertificateInfoSeqOf::Append
642 // alloc new list elmt, put at begining of list
643 // and return the component type
644 Attribute
*AttributeCertificateInfoSeqOf::Prepend()
646 AsnListElmt
*newElmt
;
647 newElmt
= new AsnListElmt
;
648 newElmt
->elmt
= new Attribute
;
649 newElmt
->prev
= NULL
;
652 newElmt
->next
= NULL
;
653 first
= last
= newElmt
;
657 newElmt
->next
= first
;
658 first
->prev
= newElmt
;
662 return (curr
= newElmt
)->elmt
;
663 } // AttributeCertificateInfoSeqOf::Prepend
666 // alloc new list elmt, insert it before the
667 // current element and return the component type
668 // if the current element is null, the new element
669 // is placed at the beginning of the list.
670 Attribute
*AttributeCertificateInfoSeqOf::InsertBefore()
672 AsnListElmt
*newElmt
;
673 newElmt
= new AsnListElmt
;
674 newElmt
->elmt
= new Attribute
;
677 newElmt
->next
= first
;
678 newElmt
->prev
= NULL
;
685 newElmt
->next
= curr
;
686 newElmt
->prev
= curr
->prev
;
687 curr
->prev
= newElmt
;
691 newElmt
->prev
->next
= newElmt
;
694 return (curr
= newElmt
)->elmt
;
695 } // AttributeCertificateInfoSeqOf::InsertBefore
698 // alloc new list elmt, insert it after the
699 // current element and return the component type
700 // if the current element is null, the new element
701 // is placed at the end of the list.
702 Attribute
*AttributeCertificateInfoSeqOf::InsertAfter()
704 AsnListElmt
*newElmt
;
705 newElmt
= new AsnListElmt
;
706 newElmt
->elmt
= new Attribute
;
709 newElmt
->prev
= last
;
710 newElmt
->next
= NULL
;
717 newElmt
->prev
= curr
;
718 newElmt
->next
= curr
->next
;
719 curr
->next
= newElmt
;
723 newElmt
->next
->prev
= newElmt
;
726 return (curr
= newElmt
)->elmt
;
727 } // AttributeCertificateInfoSeqOf::InsertAfter
730 AttributeCertificateInfoSeqOf
&AttributeCertificateInfoSeqOf::AppendCopy (Attribute
&elmt
)
732 AsnListElmt
*newElmt
;
733 newElmt
= new AsnListElmt
;
734 newElmt
->elmt
= new Attribute
;
735 *newElmt
->elmt
= elmt
;
736 newElmt
->next
= NULL
;
739 newElmt
->prev
= NULL
;
740 first
= last
= newElmt
;
744 newElmt
->prev
= last
;
745 last
->next
= newElmt
;
753 AttributeCertificateInfoSeqOf
&AttributeCertificateInfoSeqOf::PrependCopy (Attribute
&elmt
)
755 AsnListElmt
*newElmt
;
756 newElmt
= new AsnListElmt
;
757 newElmt
->elmt
= new Attribute
;
758 *newElmt
->elmt
= elmt
;
759 newElmt
->prev
= NULL
;
762 newElmt
->next
= NULL
;
763 first
= last
= newElmt
;
767 newElmt
->next
= first
;
768 first
->prev
= newElmt
;
773 } // AttributeCertificateInfoSeqOf::PrependCopy
776 // alloc new list elmt, insert it before the
777 // current element, copy the given elmt into the new elmt
778 // and return the component type.
779 // if the current element is null, the new element
780 // is placed at the beginning of the list.
781 AttributeCertificateInfoSeqOf
&AttributeCertificateInfoSeqOf::InsertBeforeAndCopy (Attribute
&elmt
)
783 AsnListElmt
*newElmt
;
785 newElmt
= new AsnListElmt
;
786 newElmt
->elmt
= new Attribute
;
787 *newElmt
->elmt
= elmt
;
791 newElmt
->next
= first
;
792 newElmt
->prev
= NULL
;
799 newElmt
->next
= curr
;
800 newElmt
->prev
= curr
->prev
;
801 curr
->prev
= newElmt
;
805 newElmt
->prev
->next
= newElmt
;
809 } // AttributeCertificateInfoSeqOf::InsertBeforeAndCopy
812 // alloc new list elmt, insert it after the
813 // current element, copy given elmt in to new elmt
814 // and return the component type
815 // if the current element is null, the new element
816 // is placed at the end of the list.
817 AttributeCertificateInfoSeqOf
&AttributeCertificateInfoSeqOf::InsertAfterAndCopy (Attribute
&elmt
)
819 AsnListElmt
*newElmt
;
821 newElmt
= new AsnListElmt
;
822 newElmt
->elmt
= new Attribute
;
823 *newElmt
->elmt
= elmt
;
826 newElmt
->prev
= last
;
827 newElmt
->next
= NULL
;
834 newElmt
->prev
= curr
;
835 newElmt
->next
= curr
->next
;
836 curr
->next
= newElmt
;
840 newElmt
->next
->prev
= newElmt
;
844 } // AttributeCertificateInfoSeqOf::InsertAfterAndCopy
847 // remove current element from list if current element is not NULL
848 // The new current element will be the next element.
849 // If the current element is the last element in the list
850 // the second but last element will become the new current element.
851 void AttributeCertificateInfoSeqOf::RemoveCurrFromList()
853 AsnListElmt
*del_elmt
;
861 first
= last
= curr
= NULL
;
862 else if (curr
== first
)
864 curr
= first
= first
->next
;
867 else if (curr
== last
)
869 curr
= last
= last
->prev
;
874 curr
->prev
->next
= curr
->next
;
875 curr
->next
->prev
= curr
->prev
;
878 delete del_elmt
->elmt
;
884 AsnLen
AttributeCertificateInfoSeqOf::BEncContent (BUF_TYPE b
)
886 AsnListElmt
*currElmt
;
889 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
892 elmtLen
= currElmt
->elmt
->BEncContent (b
);
893 elmtLen
+= BEncConsLen (b
, elmtLen
);
895 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
899 } // AttributeCertificateInfoSeqOf::BEncContent
902 void AttributeCertificateInfoSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
903 AsnLen
&bytesDecoded
, ENV_TYPE env
)
907 AsnLen listBytesDecoded
= 0;
910 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
912 tag1
= BDecTag (b
, listBytesDecoded
, env
);
913 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
915 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
918 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
920 Asn1Error
<< "Unexpected Tag" << endl
;
921 SnaccExcep::throwMe(-103);
924 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
926 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
929 bytesDecoded
+= listBytesDecoded
;
930 } // AttributeCertificateInfoSeqOf::BDecContent
933 AlgorithmIdentifier::AlgorithmIdentifier()
938 AlgorithmIdentifier::AlgorithmIdentifier (const AlgorithmIdentifier
&)
940 Asn1Error
<< "use of incompletely defined AlgorithmIdentifier::AlgorithmIdentifier (const AlgorithmIdentifier &)" << endl
;
944 AlgorithmIdentifier::~AlgorithmIdentifier()
949 AsnType
*AlgorithmIdentifier::Clone() const
951 return new AlgorithmIdentifier
;
954 AsnType
*AlgorithmIdentifier::Copy() const
956 return new AlgorithmIdentifier (*this);
960 AlgorithmIdentifier
&AlgorithmIdentifier::operator = (const AlgorithmIdentifier
&that
)
961 #else // SNACC_DEEP_COPY
962 AlgorithmIdentifier
&AlgorithmIdentifier::operator = (const AlgorithmIdentifier
&)
963 #endif // SNACC_DEEP_COPY
968 algorithm
= that
.algorithm
;
972 parameters
= new AsnAny
;
973 *parameters
= *that
.parameters
;
983 #else // SNACC_DEEP_COPY
984 Asn1Error
<< "use of incompletely defined AlgorithmIdentifier &AlgorithmIdentifier::operator = (const AlgorithmIdentifier &)" << endl
;
986 // if your compiler complains here, check the -novolat option
987 #endif // SNACC_DEEP_COPY
991 AlgorithmIdentifier::BEncContent (BUF_TYPE b
)
996 if (NOT_NULL (parameters
))
998 ENC_LOAD_ANYBUF(parameters
, b
, l
);
1002 l
= algorithm
.BEncContent (b
);
1003 l
+= BEncDefLen (b
, l
);
1005 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
1009 } // AlgorithmIdentifier::BEncContent
1012 void AlgorithmIdentifier::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1015 AsnLen seqBytesDecoded
= 0;
1017 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1019 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
1021 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1022 algorithm
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1023 if (seqBytesDecoded
== elmtLen0
)
1025 bytesDecoded
+= seqBytesDecoded
;
1030 tag1
= b
.PeekByte();
1032 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1034 BDecEoc (b
, seqBytesDecoded
, env
);
1036 bytesDecoded
+= seqBytesDecoded
;
1043 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1044 SnaccExcep::throwMe(-104);
1048 parameters
= new AsnAny
;
1049 DEC_LOAD_ANYBUF(parameters
, b
, seqBytesDecoded
, env
);
1052 bytesDecoded
+= seqBytesDecoded
;
1053 if (elmtLen0
== INDEFINITE_LEN
)
1055 BDecEoc (b
, bytesDecoded
, env
);
1058 else if (seqBytesDecoded
!= elmtLen0
)
1060 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1061 SnaccExcep::throwMe(-105);
1065 } // AlgorithmIdentifier::BDecContent
1067 AsnLen
AlgorithmIdentifier::BEnc (BUF_TYPE b
)
1070 l
= BEncContent (b
);
1071 l
+= BEncConsLen (b
, l
);
1072 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1076 void AlgorithmIdentifier::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1081 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1083 Asn1Error
<< "AlgorithmIdentifier::BDec: ERROR - wrong tag" << endl
;
1084 SnaccExcep::throwMe(-106);
1086 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1087 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1090 void AlgorithmIdentifier::Print (ostream
&os
) const
1093 os
<< "{ -- SEQUENCE --" << endl
;
1094 indentG
+= stdIndentG
;
1097 Indent (os
, indentG
);
1103 if (NOT_NULL (parameters
))
1106 Indent (os
, indentG
);
1107 os
<< "parameters ";
1112 Indent (os
, indentG
);
1113 os
<< "parameters ";
1119 indentG
-= stdIndentG
;
1120 Indent (os
, indentG
);
1123 } // AlgorithmIdentifier::Print
1128 choiceId
= utcTimeCid
;
1130 utcTime
= new UTCTime
;
1132 utcTime
= NULL
; // incomplete initialization of mandatory element!
1136 Time::Time (const Time
&)
1138 Asn1Error
<< "use of incompletely defined Time::Time (const Time &)" << endl
;
1149 case generalizedTimeCid
:
1150 delete generalizedTime
;
1153 } // end of destructor
1155 AsnType
*Time::Clone() const
1160 AsnType
*Time::Copy() const
1162 return new Time (*this);
1166 Time
&Time::operator = (const Time
&that
)
1167 #else // SNACC_DEEP_COPY
1168 Time
&Time::operator = (const Time
&)
1169 #endif // SNACC_DEEP_COPY
1179 case generalizedTimeCid
:
1180 delete generalizedTime
;
1183 switch (choiceId
= that
.choiceId
)
1186 utcTime
= new UTCTime
;
1187 *utcTime
= *that
.utcTime
;
1189 case generalizedTimeCid
:
1190 generalizedTime
= new GeneralizedTime
;
1191 *generalizedTime
= *that
.generalizedTime
;
1197 #else // SNACC_DEEP_COPY
1198 Asn1Error
<< "use of incompletely defined Time &Time::operator = (const Time &)" << endl
;
1200 // if your compiler complains here, check the -novolat option
1201 #endif // SNACC_DEEP_COPY
1205 Time::BEncContent (BUF_TYPE b
)
1211 l
= utcTime
->BEncContent (b
);
1212 l
+= BEncDefLen (b
, l
);
1214 l
+= BEncTag1 (b
, UNIV
, PRIM
, UTCTIME_TAG_CODE
);
1217 case generalizedTimeCid
:
1218 l
= generalizedTime
->BEncContent (b
);
1219 l
+= BEncDefLen (b
, l
);
1221 l
+= BEncTag1 (b
, UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
);
1226 } // Time::BEncContent
1229 void Time::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1233 case MAKE_TAG_ID (UNIV
, PRIM
, UTCTIME_TAG_CODE
):
1234 case MAKE_TAG_ID (UNIV
, CONS
, UTCTIME_TAG_CODE
):
1235 choiceId
= utcTimeCid
;
1236 utcTime
= new UTCTime
;
1237 utcTime
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
1240 case MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
):
1241 case MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
):
1242 choiceId
= generalizedTimeCid
;
1243 generalizedTime
= new GeneralizedTime
;
1244 generalizedTime
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
1248 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
1249 SnaccExcep::throwMe(-107);
1252 } // Time::BDecContent
1255 AsnLen
Time::BEnc (BUF_TYPE b
)
1258 l
= BEncContent (b
);
1262 void Time::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1267 /* CHOICEs are a special case - grab identifying tag */
1268 /* this allows easier handling of nested CHOICEs */
1269 tag
= BDecTag (b
, bytesDecoded
, env
);
1270 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
1271 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
1274 void Time::Print (ostream
&os
) const
1284 os
<< "-- void3 --\n";
1287 case generalizedTimeCid
:
1288 os
<< "generalizedTime ";
1289 if (generalizedTime
)
1290 os
<< *generalizedTime
;
1292 os
<< "-- void3 --\n";
1299 Extension::Extension()
1304 Extension::Extension (const Extension
&)
1306 Asn1Error
<< "use of incompletely defined Extension::Extension (const Extension &)" << endl
;
1310 Extension::~Extension()
1315 AsnType
*Extension::Clone() const
1317 return new Extension
;
1320 AsnType
*Extension::Copy() const
1322 return new Extension (*this);
1326 Extension
&Extension::operator = (const Extension
&that
)
1327 #else // SNACC_DEEP_COPY
1328 Extension
&Extension::operator = (const Extension
&)
1329 #endif // SNACC_DEEP_COPY
1334 extnId
= that
.extnId
;
1338 critical
= new AsnBool
;
1339 *critical
= *that
.critical
;
1346 extnValue
= that
.extnValue
;
1350 #else // SNACC_DEEP_COPY
1351 Asn1Error
<< "use of incompletely defined Extension &Extension::operator = (const Extension &)" << endl
;
1353 // if your compiler complains here, check the -novolat option
1354 #endif // SNACC_DEEP_COPY
1358 Extension::BEncContent (BUF_TYPE b
)
1360 AsnLen totalLen
= 0;
1363 l
= extnValue
.BEncContent (b
);
1364 l
+= BEncDefLen (b
, l
);
1366 l
+= BEncTag1 (b
, UNIV
, PRIM
, OCTETSTRING_TAG_CODE
);
1369 if (NOT_NULL (critical
))
1371 l
= critical
->BEncContent (b
);
1372 BEncDefLenTo127 (b
, l
);
1375 l
+= BEncTag1 (b
, UNIV
, PRIM
, BOOLEAN_TAG_CODE
);
1379 l
= extnId
.BEncContent (b
);
1380 l
+= BEncDefLen (b
, l
);
1382 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
1386 } // Extension::BEncContent
1389 void Extension::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1392 AsnLen seqBytesDecoded
= 0;
1394 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1396 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
1398 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1399 extnId
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1400 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1404 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1405 SnaccExcep::throwMe(-108);
1408 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BOOLEAN_TAG_CODE
)))
1410 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1411 critical
= new AsnBool
;
1412 critical
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1413 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1416 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OCTETSTRING_TAG_CODE
))
1417 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, OCTETSTRING_TAG_CODE
)))
1419 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1420 extnValue
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1424 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1425 SnaccExcep::throwMe(-109);
1428 bytesDecoded
+= seqBytesDecoded
;
1429 if (elmtLen0
== INDEFINITE_LEN
)
1431 BDecEoc (b
, bytesDecoded
, env
);
1434 else if (seqBytesDecoded
!= elmtLen0
)
1436 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1437 SnaccExcep::throwMe(-110);
1441 } // Extension::BDecContent
1443 AsnLen
Extension::BEnc (BUF_TYPE b
)
1446 l
= BEncContent (b
);
1447 l
+= BEncConsLen (b
, l
);
1448 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1452 void Extension::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1457 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1459 Asn1Error
<< "Extension::BDec: ERROR - wrong tag" << endl
;
1460 SnaccExcep::throwMe(-111);
1462 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1463 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1466 void Extension::Print (ostream
&os
) const
1469 os
<< "{ -- SEQUENCE --" << endl
;
1470 indentG
+= stdIndentG
;
1473 Indent (os
, indentG
);
1479 if (NOT_NULL (critical
))
1481 Indent (os
, indentG
);
1487 Indent (os
, indentG
);
1494 Indent (os
, indentG
);
1500 indentG
-= stdIndentG
;
1501 Indent (os
, indentG
);
1504 } // Extension::Print
1507 AttCertValidityPeriod::AttCertValidityPeriod()
1511 AttCertValidityPeriod::AttCertValidityPeriod (const AttCertValidityPeriod
&)
1513 Asn1Error
<< "use of incompletely defined AttCertValidityPeriod::AttCertValidityPeriod (const AttCertValidityPeriod &)" << endl
;
1517 AttCertValidityPeriod::~AttCertValidityPeriod()
1521 AsnType
*AttCertValidityPeriod::Clone() const
1523 return new AttCertValidityPeriod
;
1526 AsnType
*AttCertValidityPeriod::Copy() const
1528 return new AttCertValidityPeriod (*this);
1532 AttCertValidityPeriod
&AttCertValidityPeriod::operator = (const AttCertValidityPeriod
&that
)
1533 #else // SNACC_DEEP_COPY
1534 AttCertValidityPeriod
&AttCertValidityPeriod::operator = (const AttCertValidityPeriod
&)
1535 #endif // SNACC_DEEP_COPY
1540 notBeforeTime
= that
.notBeforeTime
;
1541 notAfterTime
= that
.notAfterTime
;
1545 #else // SNACC_DEEP_COPY
1546 Asn1Error
<< "use of incompletely defined AttCertValidityPeriod &AttCertValidityPeriod::operator = (const AttCertValidityPeriod &)" << endl
;
1548 // if your compiler complains here, check the -novolat option
1549 #endif // SNACC_DEEP_COPY
1553 AttCertValidityPeriod::BEncContent (BUF_TYPE b
)
1555 AsnLen totalLen
= 0;
1558 l
= notAfterTime
.BEncContent (b
);
1559 l
+= BEncDefLen (b
, l
);
1561 l
+= BEncTag1 (b
, UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
);
1564 l
= notBeforeTime
.BEncContent (b
);
1565 l
+= BEncDefLen (b
, l
);
1567 l
+= BEncTag1 (b
, UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
);
1571 } // AttCertValidityPeriod::BEncContent
1574 void AttCertValidityPeriod::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1577 AsnLen seqBytesDecoded
= 0;
1579 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1581 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
1582 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
1584 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1585 notBeforeTime
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1586 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1590 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1591 SnaccExcep::throwMe(-112);
1594 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
1595 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
1597 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1598 notAfterTime
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1602 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1603 SnaccExcep::throwMe(-113);
1606 bytesDecoded
+= seqBytesDecoded
;
1607 if (elmtLen0
== INDEFINITE_LEN
)
1609 BDecEoc (b
, bytesDecoded
, env
);
1612 else if (seqBytesDecoded
!= elmtLen0
)
1614 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1615 SnaccExcep::throwMe(-114);
1619 } // AttCertValidityPeriod::BDecContent
1621 AsnLen
AttCertValidityPeriod::BEnc (BUF_TYPE b
)
1624 l
= BEncContent (b
);
1625 l
+= BEncConsLen (b
, l
);
1626 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1630 void AttCertValidityPeriod::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1635 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1637 Asn1Error
<< "AttCertValidityPeriod::BDec: ERROR - wrong tag" << endl
;
1638 SnaccExcep::throwMe(-115);
1640 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1641 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1644 void AttCertValidityPeriod::Print (ostream
&os
) const
1647 os
<< "{ -- SEQUENCE --" << endl
;
1648 indentG
+= stdIndentG
;
1651 Indent (os
, indentG
);
1652 os
<< "notBeforeTime ";
1653 os
<< notBeforeTime
;
1658 Indent (os
, indentG
);
1659 os
<< "notAfterTime ";
1664 indentG
-= stdIndentG
;
1665 Indent (os
, indentG
);
1668 } // AttCertValidityPeriod::Print
1671 Validity::Validity()
1674 notBefore
= new Time
;
1676 notBefore
= NULL
; // incomplete initialization of mandatory element!
1679 notAfter
= new Time
;
1681 notAfter
= NULL
; // incomplete initialization of mandatory element!
1685 Validity::Validity (const Validity
&)
1687 Asn1Error
<< "use of incompletely defined Validity::Validity (const Validity &)" << endl
;
1691 Validity::~Validity()
1697 AsnType
*Validity::Clone() const
1699 return new Validity
;
1702 AsnType
*Validity::Copy() const
1704 return new Validity (*this);
1708 Validity
&Validity::operator = (const Validity
&that
)
1709 #else // SNACC_DEEP_COPY
1710 Validity
&Validity::operator = (const Validity
&)
1711 #endif // SNACC_DEEP_COPY
1719 notBefore
= new Time
;
1720 *notBefore
= *that
.notBefore
;
1730 notAfter
= new Time
;
1731 *notAfter
= *that
.notAfter
;
1741 #else // SNACC_DEEP_COPY
1742 Asn1Error
<< "use of incompletely defined Validity &Validity::operator = (const Validity &)" << endl
;
1744 // if your compiler complains here, check the -novolat option
1745 #endif // SNACC_DEEP_COPY
1749 Validity::BEncContent (BUF_TYPE b
)
1751 AsnLen totalLen
= 0;
1754 l
= notAfter
->BEncContent (b
);
1757 l
= notBefore
->BEncContent (b
);
1761 } // Validity::BEncContent
1764 void Validity::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1767 AsnLen seqBytesDecoded
= 0;
1769 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1771 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, UTCTIME_TAG_CODE
))
1772 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, UTCTIME_TAG_CODE
))
1773 || (tag1
== MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
1774 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
1776 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1777 notBefore
= new Time
;
1778 notBefore
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1779 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1783 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1784 SnaccExcep::throwMe(-116);
1787 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, UTCTIME_TAG_CODE
))
1788 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, UTCTIME_TAG_CODE
))
1789 || (tag1
== MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
1790 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
1792 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1793 notAfter
= new Time
;
1794 notAfter
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1798 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1799 SnaccExcep::throwMe(-117);
1802 bytesDecoded
+= seqBytesDecoded
;
1803 if (elmtLen0
== INDEFINITE_LEN
)
1805 BDecEoc (b
, bytesDecoded
, env
);
1808 else if (seqBytesDecoded
!= elmtLen0
)
1810 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1811 SnaccExcep::throwMe(-118);
1815 } // Validity::BDecContent
1817 AsnLen
Validity::BEnc (BUF_TYPE b
)
1820 l
= BEncContent (b
);
1821 l
+= BEncConsLen (b
, l
);
1822 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1826 void Validity::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1831 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1833 Asn1Error
<< "Validity::BDec: ERROR - wrong tag" << endl
;
1834 SnaccExcep::throwMe(-119);
1836 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1837 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1840 void Validity::Print (ostream
&os
) const
1843 os
<< "{ -- SEQUENCE --" << endl
;
1844 indentG
+= stdIndentG
;
1846 if (NOT_NULL (notBefore
))
1848 Indent (os
, indentG
);
1854 Indent (os
, indentG
);
1860 if (NOT_NULL (notAfter
))
1862 Indent (os
, indentG
);
1868 Indent (os
, indentG
);
1875 indentG
-= stdIndentG
;
1876 Indent (os
, indentG
);
1879 } // Validity::Print
1882 SubjectPublicKeyInfo::SubjectPublicKeyInfo()
1885 algorithm
= new AlgorithmIdentifier
;
1887 algorithm
= NULL
; // incomplete initialization of mandatory element!
1891 SubjectPublicKeyInfo::SubjectPublicKeyInfo (const SubjectPublicKeyInfo
&)
1893 Asn1Error
<< "use of incompletely defined SubjectPublicKeyInfo::SubjectPublicKeyInfo (const SubjectPublicKeyInfo &)" << endl
;
1897 SubjectPublicKeyInfo::~SubjectPublicKeyInfo()
1902 AsnType
*SubjectPublicKeyInfo::Clone() const
1904 return new SubjectPublicKeyInfo
;
1907 AsnType
*SubjectPublicKeyInfo::Copy() const
1909 return new SubjectPublicKeyInfo (*this);
1913 SubjectPublicKeyInfo
&SubjectPublicKeyInfo::operator = (const SubjectPublicKeyInfo
&that
)
1914 #else // SNACC_DEEP_COPY
1915 SubjectPublicKeyInfo
&SubjectPublicKeyInfo::operator = (const SubjectPublicKeyInfo
&)
1916 #endif // SNACC_DEEP_COPY
1924 algorithm
= new AlgorithmIdentifier
;
1925 *algorithm
= *that
.algorithm
;
1932 subjectPublicKey
= that
.subjectPublicKey
;
1936 #else // SNACC_DEEP_COPY
1937 Asn1Error
<< "use of incompletely defined SubjectPublicKeyInfo &SubjectPublicKeyInfo::operator = (const SubjectPublicKeyInfo &)" << endl
;
1939 // if your compiler complains here, check the -novolat option
1940 #endif // SNACC_DEEP_COPY
1944 SubjectPublicKeyInfo::BEncContent (BUF_TYPE b
)
1946 AsnLen totalLen
= 0;
1949 l
= subjectPublicKey
.BEncContent (b
);
1950 l
+= BEncDefLen (b
, l
);
1952 l
+= BEncTag1 (b
, UNIV
, PRIM
, BITSTRING_TAG_CODE
);
1956 l
= algorithm
->BEncContent (b
);
1957 l
+= BEncConsLen (b
, l
);
1959 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1963 } // SubjectPublicKeyInfo::BEncContent
1966 void SubjectPublicKeyInfo::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1969 AsnLen seqBytesDecoded
= 0;
1971 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1973 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1975 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1976 algorithm
= new AlgorithmIdentifier
;
1977 algorithm
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1978 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1982 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1983 SnaccExcep::throwMe(-120);
1986 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BITSTRING_TAG_CODE
))
1987 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, BITSTRING_TAG_CODE
)))
1989 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1990 subjectPublicKey
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1994 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1995 SnaccExcep::throwMe(-121);
1998 bytesDecoded
+= seqBytesDecoded
;
1999 if (elmtLen0
== INDEFINITE_LEN
)
2001 BDecEoc (b
, bytesDecoded
, env
);
2004 else if (seqBytesDecoded
!= elmtLen0
)
2006 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
2007 SnaccExcep::throwMe(-122);
2011 } // SubjectPublicKeyInfo::BDecContent
2013 AsnLen
SubjectPublicKeyInfo::BEnc (BUF_TYPE b
)
2016 l
= BEncContent (b
);
2017 l
+= BEncConsLen (b
, l
);
2018 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2022 void SubjectPublicKeyInfo::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2027 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2029 Asn1Error
<< "SubjectPublicKeyInfo::BDec: ERROR - wrong tag" << endl
;
2030 SnaccExcep::throwMe(-123);
2032 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2033 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2036 void SubjectPublicKeyInfo::Print (ostream
&os
) const
2039 os
<< "{ -- SEQUENCE --" << endl
;
2040 indentG
+= stdIndentG
;
2042 if (NOT_NULL (algorithm
))
2044 Indent (os
, indentG
);
2050 Indent (os
, indentG
);
2057 Indent (os
, indentG
);
2058 os
<< "subjectPublicKey ";
2059 os
<< subjectPublicKey
;
2063 indentG
-= stdIndentG
;
2064 Indent (os
, indentG
);
2067 } // SubjectPublicKeyInfo::Print
2070 AsnType
*Extensions::Clone() const
2072 return new Extensions
;
2075 AsnType
*Extensions::Copy() const
2077 return new Extensions (*this);
2080 AsnLen
Extensions::BEnc (BUF_TYPE b
)
2083 l
= BEncContent (b
);
2084 l
+= BEncConsLen (b
, l
);
2085 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2089 void Extensions::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2094 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2096 Asn1Error
<< "Extensions::BDec: ERROR - wrong tag" << endl
;
2097 SnaccExcep::throwMe(-124);
2099 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2100 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2103 Extensions::Extensions (const Extensions
&)
2105 Asn1Error
<< "use of incompletely defined Extensions::Extensions (const Extensions &)" << endl
;
2109 Extensions::~Extensions()
2112 for (; Curr() != NULL
; RemoveCurrFromList())
2114 } // end of destructor
2117 Extensions
&Extensions::operator = (const Extensions
&that
)
2118 #else // SNACC_DEEP_COPY
2119 Extensions
&Extensions::operator = (const Extensions
&)
2120 #endif // SNACC_DEEP_COPY
2126 for (; Curr(); RemoveCurrFromList())
2129 //that.SetCurrToFirst();
2130 //for (; that.Curr(); that.GoNext())
2131 // AppendCopy (*that.Curr());
2132 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2133 AppendCopy (*run
->elmt
);
2137 #else // SNACC_DEEP_COPY
2138 Asn1Error
<< "use of incompletely defined Extensions &Extensions::operator = (const Extensions &)" << endl
;
2140 // if your compiler complains here, check the -novolat option
2141 #endif // SNACC_DEEP_COPY
2144 void Extensions::Print (ostream
&os
) const
2147 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2148 indentG
+= stdIndentG
;
2150 //for (; Curr() != NULL; GoNext())
2151 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2153 Indent (os
, indentG
);
2156 //if (Curr() != Last())
2161 indentG
-= stdIndentG
;
2162 Indent (os
, indentG
);
2170 void Extensions::SetCurrElmt (unsigned long int index
)
2172 unsigned long int i
;
2175 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2177 } // Extensions::SetCurrElmt
2180 unsigned long int Extensions::GetCurrElmtIndex()
2182 unsigned long int i
;
2186 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2195 } // Extensions::GetCurrElmtIndex
2198 // alloc new list elmt, put at end of list
2199 // and return the component type
2200 Extension
*Extensions::Append()
2202 AsnListElmt
*newElmt
;
2203 newElmt
= new AsnListElmt
;
2204 newElmt
->elmt
= new Extension
;
2205 newElmt
->next
= NULL
;
2208 newElmt
->prev
= NULL
;
2209 first
= last
= newElmt
;
2213 newElmt
->prev
= last
;
2214 last
->next
= newElmt
;
2218 return (curr
= newElmt
)->elmt
;
2219 } // Extensions::Append
2222 // alloc new list elmt, put at begining of list
2223 // and return the component type
2224 Extension
*Extensions::Prepend()
2226 AsnListElmt
*newElmt
;
2227 newElmt
= new AsnListElmt
;
2228 newElmt
->elmt
= new Extension
;
2229 newElmt
->prev
= NULL
;
2232 newElmt
->next
= NULL
;
2233 first
= last
= newElmt
;
2237 newElmt
->next
= first
;
2238 first
->prev
= newElmt
;
2242 return (curr
= newElmt
)->elmt
;
2243 } // Extensions::Prepend
2246 // alloc new list elmt, insert it before the
2247 // current element and return the component type
2248 // if the current element is null, the new element
2249 // is placed at the beginning of the list.
2250 Extension
*Extensions::InsertBefore()
2252 AsnListElmt
*newElmt
;
2253 newElmt
= new AsnListElmt
;
2254 newElmt
->elmt
= new Extension
;
2257 newElmt
->next
= first
;
2258 newElmt
->prev
= NULL
;
2265 newElmt
->next
= curr
;
2266 newElmt
->prev
= curr
->prev
;
2267 curr
->prev
= newElmt
;
2271 newElmt
->prev
->next
= newElmt
;
2274 return (curr
= newElmt
)->elmt
;
2275 } // Extensions::InsertBefore
2278 // alloc new list elmt, insert it after the
2279 // current element and return the component type
2280 // if the current element is null, the new element
2281 // is placed at the end of the list.
2282 Extension
*Extensions::InsertAfter()
2284 AsnListElmt
*newElmt
;
2285 newElmt
= new AsnListElmt
;
2286 newElmt
->elmt
= new Extension
;
2289 newElmt
->prev
= last
;
2290 newElmt
->next
= NULL
;
2297 newElmt
->prev
= curr
;
2298 newElmt
->next
= curr
->next
;
2299 curr
->next
= newElmt
;
2303 newElmt
->next
->prev
= newElmt
;
2306 return (curr
= newElmt
)->elmt
;
2307 } // Extensions::InsertAfter
2310 Extensions
&Extensions::AppendCopy (Extension
&elmt
)
2312 AsnListElmt
*newElmt
;
2313 newElmt
= new AsnListElmt
;
2314 newElmt
->elmt
= new Extension
;
2315 *newElmt
->elmt
= elmt
;
2316 newElmt
->next
= NULL
;
2319 newElmt
->prev
= NULL
;
2320 first
= last
= newElmt
;
2324 newElmt
->prev
= last
;
2325 last
->next
= newElmt
;
2333 Extensions
&Extensions::PrependCopy (Extension
&elmt
)
2335 AsnListElmt
*newElmt
;
2336 newElmt
= new AsnListElmt
;
2337 newElmt
->elmt
= new Extension
;
2338 *newElmt
->elmt
= elmt
;
2339 newElmt
->prev
= NULL
;
2342 newElmt
->next
= NULL
;
2343 first
= last
= newElmt
;
2347 newElmt
->next
= first
;
2348 first
->prev
= newElmt
;
2353 } // Extensions::PrependCopy
2356 // alloc new list elmt, insert it before the
2357 // current element, copy the given elmt into the new elmt
2358 // and return the component type.
2359 // if the current element is null, the new element
2360 // is placed at the beginning of the list.
2361 Extensions
&Extensions::InsertBeforeAndCopy (Extension
&elmt
)
2363 AsnListElmt
*newElmt
;
2365 newElmt
= new AsnListElmt
;
2366 newElmt
->elmt
= new Extension
;
2367 *newElmt
->elmt
= elmt
;
2371 newElmt
->next
= first
;
2372 newElmt
->prev
= NULL
;
2379 newElmt
->next
= curr
;
2380 newElmt
->prev
= curr
->prev
;
2381 curr
->prev
= newElmt
;
2385 newElmt
->prev
->next
= newElmt
;
2389 } // Extensions::InsertBeforeAndCopy
2392 // alloc new list elmt, insert it after the
2393 // current element, copy given elmt in to new elmt
2394 // and return the component type
2395 // if the current element is null, the new element
2396 // is placed at the end of the list.
2397 Extensions
&Extensions::InsertAfterAndCopy (Extension
&elmt
)
2399 AsnListElmt
*newElmt
;
2401 newElmt
= new AsnListElmt
;
2402 newElmt
->elmt
= new Extension
;
2403 *newElmt
->elmt
= elmt
;
2406 newElmt
->prev
= last
;
2407 newElmt
->next
= NULL
;
2414 newElmt
->prev
= curr
;
2415 newElmt
->next
= curr
->next
;
2416 curr
->next
= newElmt
;
2420 newElmt
->next
->prev
= newElmt
;
2424 } // Extensions::InsertAfterAndCopy
2427 // remove current element from list if current element is not NULL
2428 // The new current element will be the next element.
2429 // If the current element is the last element in the list
2430 // the second but last element will become the new current element.
2431 void Extensions::RemoveCurrFromList()
2433 AsnListElmt
*del_elmt
;
2441 first
= last
= curr
= NULL
;
2442 else if (curr
== first
)
2444 curr
= first
= first
->next
;
2447 else if (curr
== last
)
2449 curr
= last
= last
->prev
;
2454 curr
->prev
->next
= curr
->next
;
2455 curr
->next
->prev
= curr
->prev
;
2458 delete del_elmt
->elmt
;
2464 AsnLen
Extensions::BEncContent (BUF_TYPE b
)
2466 AsnListElmt
*currElmt
;
2468 AsnLen totalLen
= 0;
2469 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
2472 elmtLen
= currElmt
->elmt
->BEncContent (b
);
2473 elmtLen
+= BEncConsLen (b
, elmtLen
);
2475 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2476 totalLen
+= elmtLen
;
2479 } // Extensions::BEncContent
2482 void Extensions::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
2483 AsnLen
&bytesDecoded
, ENV_TYPE env
)
2485 Extension
*listElmt
;
2487 AsnLen listBytesDecoded
= 0;
2490 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
2492 tag1
= BDecTag (b
, listBytesDecoded
, env
);
2493 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
2495 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
2498 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
2500 Asn1Error
<< "Unexpected Tag" << endl
;
2501 SnaccExcep::throwMe(-125);
2504 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
2505 listElmt
= Append();
2506 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
2509 bytesDecoded
+= listBytesDecoded
;
2510 } // Extensions::BDecContent
2513 IssuerSerial::IssuerSerial()
2518 IssuerSerial::IssuerSerial (const IssuerSerial
&)
2520 Asn1Error
<< "use of incompletely defined IssuerSerial::IssuerSerial (const IssuerSerial &)" << endl
;
2524 IssuerSerial::~IssuerSerial()
2529 AsnType
*IssuerSerial::Clone() const
2531 return new IssuerSerial
;
2534 AsnType
*IssuerSerial::Copy() const
2536 return new IssuerSerial (*this);
2540 IssuerSerial
&IssuerSerial::operator = (const IssuerSerial
&that
)
2541 #else // SNACC_DEEP_COPY
2542 IssuerSerial
&IssuerSerial::operator = (const IssuerSerial
&)
2543 #endif // SNACC_DEEP_COPY
2548 issuer
= that
.issuer
;
2549 serial
= that
.serial
;
2553 issuerUID
= new UniqueIdentifier
;
2554 *issuerUID
= *that
.issuerUID
;
2564 #else // SNACC_DEEP_COPY
2565 Asn1Error
<< "use of incompletely defined IssuerSerial &IssuerSerial::operator = (const IssuerSerial &)" << endl
;
2567 // if your compiler complains here, check the -novolat option
2568 #endif // SNACC_DEEP_COPY
2572 IssuerSerial::BEncContent (BUF_TYPE b
)
2574 AsnLen totalLen
= 0;
2577 if (NOT_NULL (issuerUID
))
2579 l
= issuerUID
->BEncContent (b
);
2580 l
+= BEncDefLen (b
, l
);
2582 l
+= BEncTag1 (b
, UNIV
, PRIM
, BITSTRING_TAG_CODE
);
2586 l
= serial
.BEncContent (b
);
2587 l
+= BEncDefLen (b
, l
);
2589 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
2593 l
= issuer
.BEncContent (b
);
2594 l
+= BEncConsLen (b
, l
);
2596 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2600 } // IssuerSerial::BEncContent
2603 void IssuerSerial::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2606 AsnLen seqBytesDecoded
= 0;
2608 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2610 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
2612 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2613 issuer
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
2614 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2618 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
2619 SnaccExcep::throwMe(-126);
2622 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))
2623 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, INTEGER_TAG_CODE
)))
2625 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2626 serial
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
2627 if (seqBytesDecoded
== elmtLen0
)
2629 bytesDecoded
+= seqBytesDecoded
;
2634 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2636 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
2638 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
2639 bytesDecoded
+= seqBytesDecoded
;
2646 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
2647 SnaccExcep::throwMe(-127);
2650 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BITSTRING_TAG_CODE
))
2651 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, BITSTRING_TAG_CODE
)))
2653 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2654 issuerUID
= new UniqueIdentifier
;
2655 issuerUID
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
2658 bytesDecoded
+= seqBytesDecoded
;
2659 if (elmtLen0
== INDEFINITE_LEN
)
2661 BDecEoc (b
, bytesDecoded
, env
);
2664 else if (seqBytesDecoded
!= elmtLen0
)
2666 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
2667 SnaccExcep::throwMe(-128);
2671 } // IssuerSerial::BDecContent
2673 AsnLen
IssuerSerial::BEnc (BUF_TYPE b
)
2676 l
= BEncContent (b
);
2677 l
+= BEncConsLen (b
, l
);
2678 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2682 void IssuerSerial::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2687 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2689 Asn1Error
<< "IssuerSerial::BDec: ERROR - wrong tag" << endl
;
2690 SnaccExcep::throwMe(-129);
2692 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2693 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2696 void IssuerSerial::Print (ostream
&os
) const
2699 os
<< "{ -- SEQUENCE --" << endl
;
2700 indentG
+= stdIndentG
;
2703 Indent (os
, indentG
);
2710 Indent (os
, indentG
);
2716 if (NOT_NULL (issuerUID
))
2719 Indent (os
, indentG
);
2725 Indent (os
, indentG
);
2732 indentG
-= stdIndentG
;
2733 Indent (os
, indentG
);
2736 } // IssuerSerial::Print
2739 AttributeCertificateAssertionChoice::AttributeCertificateAssertionChoice()
2741 choiceId
= baseCertificateIDCid
;
2743 baseCertificateID
= new IssuerSerial
;
2745 baseCertificateID
= NULL
; // incomplete initialization of mandatory element!
2749 AttributeCertificateAssertionChoice::AttributeCertificateAssertionChoice (const AttributeCertificateAssertionChoice
&)
2751 Asn1Error
<< "use of incompletely defined AttributeCertificateAssertionChoice::AttributeCertificateAssertionChoice (const AttributeCertificateAssertionChoice &)" << endl
;
2755 AttributeCertificateAssertionChoice::~AttributeCertificateAssertionChoice()
2759 case baseCertificateIDCid
:
2760 delete baseCertificateID
;
2762 case subjectNameCid
:
2766 } // end of destructor
2768 AsnType
*AttributeCertificateAssertionChoice::Clone() const
2770 return new AttributeCertificateAssertionChoice
;
2773 AsnType
*AttributeCertificateAssertionChoice::Copy() const
2775 return new AttributeCertificateAssertionChoice (*this);
2779 AttributeCertificateAssertionChoice
&AttributeCertificateAssertionChoice::operator = (const AttributeCertificateAssertionChoice
&that
)
2780 #else // SNACC_DEEP_COPY
2781 AttributeCertificateAssertionChoice
&AttributeCertificateAssertionChoice::operator = (const AttributeCertificateAssertionChoice
&)
2782 #endif // SNACC_DEEP_COPY
2789 case baseCertificateIDCid
:
2790 delete baseCertificateID
;
2792 case subjectNameCid
:
2796 switch (choiceId
= that
.choiceId
)
2798 case baseCertificateIDCid
:
2799 baseCertificateID
= new IssuerSerial
;
2800 *baseCertificateID
= *that
.baseCertificateID
;
2802 case subjectNameCid
:
2803 subjectName
= new Name
;
2804 *subjectName
= *that
.subjectName
;
2810 #else // SNACC_DEEP_COPY
2811 Asn1Error
<< "use of incompletely defined AttributeCertificateAssertionChoice &AttributeCertificateAssertionChoice::operator = (const AttributeCertificateAssertionChoice &)" << endl
;
2813 // if your compiler complains here, check the -novolat option
2814 #endif // SNACC_DEEP_COPY
2818 AttributeCertificateAssertionChoice::BEncContent (BUF_TYPE b
)
2823 case baseCertificateIDCid
:
2826 l
= baseCertificateID
->BEncContent (b
);
2827 l
+= BEncConsLen (b
, l
);
2829 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2830 l
+= BEncConsLen (b
, l
);
2832 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
2835 case subjectNameCid
:
2837 l
= subjectName
->BEncContent (b
);
2838 l
+= BEncConsLen (b
, l
);
2840 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
2845 } // AttributeCertificateAssertionChoice::BEncContent
2848 void AttributeCertificateAssertionChoice::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2853 case MAKE_TAG_ID (CNTX
, CONS
, 0):
2854 tag
= BDecTag (b
, bytesDecoded
, env
);
2855 if (tag
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2857 Asn1Error
<< "Unexpected Tag" << endl
;
2858 SnaccExcep::throwMe(-130);
2861 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2862 choiceId
= baseCertificateIDCid
;
2863 baseCertificateID
= new IssuerSerial
;
2864 baseCertificateID
->BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2865 if (elmtLen0
== INDEFINITE_LEN
)
2866 BDecEoc (b
, bytesDecoded
, env
);
2869 case MAKE_TAG_ID (CNTX
, CONS
, 1):
2870 tag
= BDecTag (b
, bytesDecoded
, env
);
2871 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2872 choiceId
= subjectNameCid
;
2873 subjectName
= new Name
;
2874 subjectName
->BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2875 if (elmtLen0
== INDEFINITE_LEN
)
2876 BDecEoc (b
, bytesDecoded
, env
);
2880 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
2881 SnaccExcep::throwMe(-131);
2884 } // AttributeCertificateAssertionChoice::BDecContent
2887 AsnLen
AttributeCertificateAssertionChoice::BEnc (BUF_TYPE b
)
2890 l
= BEncContent (b
);
2894 void AttributeCertificateAssertionChoice::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2899 /* CHOICEs are a special case - grab identifying tag */
2900 /* this allows easier handling of nested CHOICEs */
2901 tag
= BDecTag (b
, bytesDecoded
, env
);
2902 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
2903 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
2906 void AttributeCertificateAssertionChoice::Print (ostream
&os
) const
2911 case baseCertificateIDCid
:
2912 os
<< "baseCertificateID ";
2913 if (baseCertificateID
)
2914 os
<< *baseCertificateID
;
2916 os
<< "-- void3 --\n";
2919 case subjectNameCid
:
2920 os
<< "subjectName ";
2924 os
<< "-- void3 --\n";
2929 } // AttributeCertificateAssertionChoice::Print
2931 AttributeCertificateInfoChoice::AttributeCertificateInfoChoice()
2933 choiceId
= baseCertificateIDCid
;
2935 baseCertificateID
= new IssuerSerial
;
2937 baseCertificateID
= NULL
; // incomplete initialization of mandatory element!
2941 AttributeCertificateInfoChoice::AttributeCertificateInfoChoice (const AttributeCertificateInfoChoice
&)
2943 Asn1Error
<< "use of incompletely defined AttributeCertificateInfoChoice::AttributeCertificateInfoChoice (const AttributeCertificateInfoChoice &)" << endl
;
2947 AttributeCertificateInfoChoice::~AttributeCertificateInfoChoice()
2951 case baseCertificateIDCid
:
2952 delete baseCertificateID
;
2954 case subjectNameCid
:
2958 } // end of destructor
2960 AsnType
*AttributeCertificateInfoChoice::Clone() const
2962 return new AttributeCertificateInfoChoice
;
2965 AsnType
*AttributeCertificateInfoChoice::Copy() const
2967 return new AttributeCertificateInfoChoice (*this);
2971 AttributeCertificateInfoChoice
&AttributeCertificateInfoChoice::operator = (const AttributeCertificateInfoChoice
&that
)
2972 #else // SNACC_DEEP_COPY
2973 AttributeCertificateInfoChoice
&AttributeCertificateInfoChoice::operator = (const AttributeCertificateInfoChoice
&)
2974 #endif // SNACC_DEEP_COPY
2981 case baseCertificateIDCid
:
2982 delete baseCertificateID
;
2984 case subjectNameCid
:
2988 switch (choiceId
= that
.choiceId
)
2990 case baseCertificateIDCid
:
2991 baseCertificateID
= new IssuerSerial
;
2992 *baseCertificateID
= *that
.baseCertificateID
;
2994 case subjectNameCid
:
2995 subjectName
= new GeneralNames
;
2996 *subjectName
= *that
.subjectName
;
3002 #else // SNACC_DEEP_COPY
3003 Asn1Error
<< "use of incompletely defined AttributeCertificateInfoChoice &AttributeCertificateInfoChoice::operator = (const AttributeCertificateInfoChoice &)" << endl
;
3005 // if your compiler complains here, check the -novolat option
3006 #endif // SNACC_DEEP_COPY
3010 AttributeCertificateInfoChoice::BEncContent (BUF_TYPE b
)
3015 case baseCertificateIDCid
:
3018 l
= baseCertificateID
->BEncContent (b
);
3019 l
+= BEncConsLen (b
, l
);
3021 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3022 l
+= BEncConsLen (b
, l
);
3024 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
3027 case subjectNameCid
:
3030 l
= subjectName
->BEncContent (b
);
3031 l
+= BEncConsLen (b
, l
);
3033 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3034 l
+= BEncConsLen (b
, l
);
3036 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
3041 } // AttributeCertificateInfoChoice::BEncContent
3044 void AttributeCertificateInfoChoice::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3049 case MAKE_TAG_ID (CNTX
, CONS
, 0):
3050 tag
= BDecTag (b
, bytesDecoded
, env
);
3051 if (tag
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3053 Asn1Error
<< "Unexpected Tag" << endl
;
3054 SnaccExcep::throwMe(-132);
3057 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3058 choiceId
= baseCertificateIDCid
;
3059 baseCertificateID
= new IssuerSerial
;
3060 baseCertificateID
->BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3061 if (elmtLen0
== INDEFINITE_LEN
)
3062 BDecEoc (b
, bytesDecoded
, env
);
3065 case MAKE_TAG_ID (CNTX
, CONS
, 1):
3066 tag
= BDecTag (b
, bytesDecoded
, env
);
3067 if (tag
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3069 Asn1Error
<< "Unexpected Tag" << endl
;
3070 SnaccExcep::throwMe(-133);
3073 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3074 choiceId
= subjectNameCid
;
3075 subjectName
= new GeneralNames
;
3076 subjectName
->BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3077 if (elmtLen0
== INDEFINITE_LEN
)
3078 BDecEoc (b
, bytesDecoded
, env
);
3082 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
3083 SnaccExcep::throwMe(-134);
3086 } // AttributeCertificateInfoChoice::BDecContent
3089 AsnLen
AttributeCertificateInfoChoice::BEnc (BUF_TYPE b
)
3092 l
= BEncContent (b
);
3096 void AttributeCertificateInfoChoice::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3101 /* CHOICEs are a special case - grab identifying tag */
3102 /* this allows easier handling of nested CHOICEs */
3103 tag
= BDecTag (b
, bytesDecoded
, env
);
3104 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
3105 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
3108 void AttributeCertificateInfoChoice::Print (ostream
&os
) const
3113 case baseCertificateIDCid
:
3114 os
<< "baseCertificateID ";
3115 if (baseCertificateID
)
3116 os
<< *baseCertificateID
;
3118 os
<< "-- void3 --\n";
3121 case subjectNameCid
:
3122 os
<< "subjectName ";
3126 os
<< "-- void3 --\n";
3131 } // AttributeCertificateInfoChoice::Print
3133 CRLToSignSeqOfSeq::CRLToSignSeqOfSeq()
3136 revocationDate
= new Time
;
3138 revocationDate
= NULL
; // incomplete initialization of mandatory element!
3140 crlEntryExtensions
= NULL
;
3143 CRLToSignSeqOfSeq::CRLToSignSeqOfSeq (const CRLToSignSeqOfSeq
&)
3145 Asn1Error
<< "use of incompletely defined CRLToSignSeqOfSeq::CRLToSignSeqOfSeq (const CRLToSignSeqOfSeq &)" << endl
;
3149 CRLToSignSeqOfSeq::~CRLToSignSeqOfSeq()
3151 delete revocationDate
;
3152 delete crlEntryExtensions
;
3155 AsnType
*CRLToSignSeqOfSeq::Clone() const
3157 return new CRLToSignSeqOfSeq
;
3160 AsnType
*CRLToSignSeqOfSeq::Copy() const
3162 return new CRLToSignSeqOfSeq (*this);
3166 CRLToSignSeqOfSeq
&CRLToSignSeqOfSeq::operator = (const CRLToSignSeqOfSeq
&that
)
3167 #else // SNACC_DEEP_COPY
3168 CRLToSignSeqOfSeq
&CRLToSignSeqOfSeq::operator = (const CRLToSignSeqOfSeq
&)
3169 #endif // SNACC_DEEP_COPY
3174 userCertificate
= that
.userCertificate
;
3175 if (that
.revocationDate
)
3177 if (!revocationDate
)
3178 revocationDate
= new Time
;
3179 *revocationDate
= *that
.revocationDate
;
3183 delete revocationDate
;
3184 revocationDate
= NULL
;
3186 if (that
.crlEntryExtensions
)
3188 if (!crlEntryExtensions
)
3189 crlEntryExtensions
= new Extensions
;
3190 *crlEntryExtensions
= *that
.crlEntryExtensions
;
3194 delete crlEntryExtensions
;
3195 crlEntryExtensions
= NULL
;
3200 #else // SNACC_DEEP_COPY
3201 Asn1Error
<< "use of incompletely defined CRLToSignSeqOfSeq &CRLToSignSeqOfSeq::operator = (const CRLToSignSeqOfSeq &)" << endl
;
3203 // if your compiler complains here, check the -novolat option
3204 #endif // SNACC_DEEP_COPY
3208 CRLToSignSeqOfSeq::BEncContent (BUF_TYPE b
)
3210 AsnLen totalLen
= 0;
3213 if (NOT_NULL (crlEntryExtensions
))
3216 l
= crlEntryExtensions
->BEncContent (b
);
3217 l
+= BEncConsLen (b
, l
);
3219 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3223 l
= revocationDate
->BEncContent (b
);
3226 l
= userCertificate
.BEncContent (b
);
3227 l
+= BEncDefLen (b
, l
);
3229 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
3233 } // CRLToSignSeqOfSeq::BEncContent
3236 void CRLToSignSeqOfSeq::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3239 AsnLen seqBytesDecoded
= 0;
3241 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3243 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))
3244 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, INTEGER_TAG_CODE
)))
3246 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3247 userCertificate
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3248 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3252 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
3253 SnaccExcep::throwMe(-135);
3256 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, UTCTIME_TAG_CODE
))
3257 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, UTCTIME_TAG_CODE
))
3258 || (tag1
== MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
3259 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
3261 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3262 revocationDate
= new Time
;
3263 revocationDate
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3264 if (seqBytesDecoded
== elmtLen0
)
3266 bytesDecoded
+= seqBytesDecoded
;
3271 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3273 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3275 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3276 bytesDecoded
+= seqBytesDecoded
;
3283 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
3284 SnaccExcep::throwMe(-136);
3287 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3289 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3290 crlEntryExtensions
= new Extensions
;
3291 crlEntryExtensions
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3294 bytesDecoded
+= seqBytesDecoded
;
3295 if (elmtLen0
== INDEFINITE_LEN
)
3297 BDecEoc (b
, bytesDecoded
, env
);
3300 else if (seqBytesDecoded
!= elmtLen0
)
3302 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
3303 SnaccExcep::throwMe(-137);
3307 } // CRLToSignSeqOfSeq::BDecContent
3309 AsnLen
CRLToSignSeqOfSeq::BEnc (BUF_TYPE b
)
3312 l
= BEncContent (b
);
3313 l
+= BEncConsLen (b
, l
);
3314 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3318 void CRLToSignSeqOfSeq::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3323 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3325 Asn1Error
<< "CRLToSignSeqOfSeq::BDec: ERROR - wrong tag" << endl
;
3326 SnaccExcep::throwMe(-138);
3328 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3329 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3332 void CRLToSignSeqOfSeq::Print (ostream
&os
) const
3335 os
<< "{ -- SEQUENCE --" << endl
;
3336 indentG
+= stdIndentG
;
3339 Indent (os
, indentG
);
3340 os
<< "userCertificate ";
3341 os
<< userCertificate
;
3345 if (NOT_NULL (revocationDate
))
3347 Indent (os
, indentG
);
3348 os
<< "revocationDate ";
3349 os
<< *revocationDate
;
3353 Indent (os
, indentG
);
3354 os
<< "revocationDate ";
3359 if (NOT_NULL (crlEntryExtensions
))
3362 Indent (os
, indentG
);
3363 os
<< "crlEntryExtensions ";
3364 os
<< *crlEntryExtensions
;
3368 Indent (os
, indentG
);
3369 os
<< "crlEntryExtensions ";
3375 indentG
-= stdIndentG
;
3376 Indent (os
, indentG
);
3379 } // CRLToSignSeqOfSeq::Print
3382 AsnType
*CRLToSignSeqOf::Clone() const
3384 return new CRLToSignSeqOf
;
3387 AsnType
*CRLToSignSeqOf::Copy() const
3389 return new CRLToSignSeqOf (*this);
3392 AsnLen
CRLToSignSeqOf::BEnc (BUF_TYPE b
)
3395 l
= BEncContent (b
);
3396 l
+= BEncConsLen (b
, l
);
3397 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3401 void CRLToSignSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3406 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3408 Asn1Error
<< "CRLToSignSeqOf::BDec: ERROR - wrong tag" << endl
;
3409 SnaccExcep::throwMe(-139);
3411 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3412 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3415 CRLToSignSeqOf::CRLToSignSeqOf (const CRLToSignSeqOf
&)
3417 Asn1Error
<< "use of incompletely defined CRLToSignSeqOf::CRLToSignSeqOf (const CRLToSignSeqOf &)" << endl
;
3421 CRLToSignSeqOf::~CRLToSignSeqOf()
3424 for (; Curr() != NULL
; RemoveCurrFromList())
3426 } // end of destructor
3429 CRLToSignSeqOf
&CRLToSignSeqOf::operator = (const CRLToSignSeqOf
&that
)
3430 #else // SNACC_DEEP_COPY
3431 CRLToSignSeqOf
&CRLToSignSeqOf::operator = (const CRLToSignSeqOf
&)
3432 #endif // SNACC_DEEP_COPY
3438 for (; Curr(); RemoveCurrFromList())
3441 //that.SetCurrToFirst();
3442 //for (; that.Curr(); that.GoNext())
3443 // AppendCopy (*that.Curr());
3444 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
3445 AppendCopy (*run
->elmt
);
3449 #else // SNACC_DEEP_COPY
3450 Asn1Error
<< "use of incompletely defined CRLToSignSeqOf &CRLToSignSeqOf::operator = (const CRLToSignSeqOf &)" << endl
;
3452 // if your compiler complains here, check the -novolat option
3453 #endif // SNACC_DEEP_COPY
3456 void CRLToSignSeqOf::Print (ostream
&os
) const
3459 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
3460 indentG
+= stdIndentG
;
3462 //for (; Curr() != NULL; GoNext())
3463 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
3465 Indent (os
, indentG
);
3468 //if (Curr() != Last())
3473 indentG
-= stdIndentG
;
3474 Indent (os
, indentG
);
3482 void CRLToSignSeqOf::SetCurrElmt (unsigned long int index
)
3484 unsigned long int i
;
3487 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
3489 } // CRLToSignSeqOf::SetCurrElmt
3492 unsigned long int CRLToSignSeqOf::GetCurrElmtIndex()
3494 unsigned long int i
;
3498 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
3507 } // CRLToSignSeqOf::GetCurrElmtIndex
3510 // alloc new list elmt, put at end of list
3511 // and return the component type
3512 CRLToSignSeqOfSeq
*CRLToSignSeqOf::Append()
3514 AsnListElmt
*newElmt
;
3515 newElmt
= new AsnListElmt
;
3516 newElmt
->elmt
= new CRLToSignSeqOfSeq
;
3517 newElmt
->next
= NULL
;
3520 newElmt
->prev
= NULL
;
3521 first
= last
= newElmt
;
3525 newElmt
->prev
= last
;
3526 last
->next
= newElmt
;
3530 return (curr
= newElmt
)->elmt
;
3531 } // CRLToSignSeqOf::Append
3534 // alloc new list elmt, put at begining of list
3535 // and return the component type
3536 CRLToSignSeqOfSeq
*CRLToSignSeqOf::Prepend()
3538 AsnListElmt
*newElmt
;
3539 newElmt
= new AsnListElmt
;
3540 newElmt
->elmt
= new CRLToSignSeqOfSeq
;
3541 newElmt
->prev
= NULL
;
3544 newElmt
->next
= NULL
;
3545 first
= last
= newElmt
;
3549 newElmt
->next
= first
;
3550 first
->prev
= newElmt
;
3554 return (curr
= newElmt
)->elmt
;
3555 } // CRLToSignSeqOf::Prepend
3558 // alloc new list elmt, insert it before the
3559 // current element and return the component type
3560 // if the current element is null, the new element
3561 // is placed at the beginning of the list.
3562 CRLToSignSeqOfSeq
*CRLToSignSeqOf::InsertBefore()
3564 AsnListElmt
*newElmt
;
3565 newElmt
= new AsnListElmt
;
3566 newElmt
->elmt
= new CRLToSignSeqOfSeq
;
3569 newElmt
->next
= first
;
3570 newElmt
->prev
= NULL
;
3577 newElmt
->next
= curr
;
3578 newElmt
->prev
= curr
->prev
;
3579 curr
->prev
= newElmt
;
3583 newElmt
->prev
->next
= newElmt
;
3586 return (curr
= newElmt
)->elmt
;
3587 } // CRLToSignSeqOf::InsertBefore
3590 // alloc new list elmt, insert it after the
3591 // current element and return the component type
3592 // if the current element is null, the new element
3593 // is placed at the end of the list.
3594 CRLToSignSeqOfSeq
*CRLToSignSeqOf::InsertAfter()
3596 AsnListElmt
*newElmt
;
3597 newElmt
= new AsnListElmt
;
3598 newElmt
->elmt
= new CRLToSignSeqOfSeq
;
3601 newElmt
->prev
= last
;
3602 newElmt
->next
= NULL
;
3609 newElmt
->prev
= curr
;
3610 newElmt
->next
= curr
->next
;
3611 curr
->next
= newElmt
;
3615 newElmt
->next
->prev
= newElmt
;
3618 return (curr
= newElmt
)->elmt
;
3619 } // CRLToSignSeqOf::InsertAfter
3622 CRLToSignSeqOf
&CRLToSignSeqOf::AppendCopy (CRLToSignSeqOfSeq
&elmt
)
3624 AsnListElmt
*newElmt
;
3625 newElmt
= new AsnListElmt
;
3626 newElmt
->elmt
= new CRLToSignSeqOfSeq
;
3627 *newElmt
->elmt
= elmt
;
3628 newElmt
->next
= NULL
;
3631 newElmt
->prev
= NULL
;
3632 first
= last
= newElmt
;
3636 newElmt
->prev
= last
;
3637 last
->next
= newElmt
;
3645 CRLToSignSeqOf
&CRLToSignSeqOf::PrependCopy (CRLToSignSeqOfSeq
&elmt
)
3647 AsnListElmt
*newElmt
;
3648 newElmt
= new AsnListElmt
;
3649 newElmt
->elmt
= new CRLToSignSeqOfSeq
;
3650 *newElmt
->elmt
= elmt
;
3651 newElmt
->prev
= NULL
;
3654 newElmt
->next
= NULL
;
3655 first
= last
= newElmt
;
3659 newElmt
->next
= first
;
3660 first
->prev
= newElmt
;
3665 } // CRLToSignSeqOf::PrependCopy
3668 // alloc new list elmt, insert it before the
3669 // current element, copy the given elmt into the new elmt
3670 // and return the component type.
3671 // if the current element is null, the new element
3672 // is placed at the beginning of the list.
3673 CRLToSignSeqOf
&CRLToSignSeqOf::InsertBeforeAndCopy (CRLToSignSeqOfSeq
&elmt
)
3675 AsnListElmt
*newElmt
;
3677 newElmt
= new AsnListElmt
;
3678 newElmt
->elmt
= new CRLToSignSeqOfSeq
;
3679 *newElmt
->elmt
= elmt
;
3683 newElmt
->next
= first
;
3684 newElmt
->prev
= NULL
;
3691 newElmt
->next
= curr
;
3692 newElmt
->prev
= curr
->prev
;
3693 curr
->prev
= newElmt
;
3697 newElmt
->prev
->next
= newElmt
;
3701 } // CRLToSignSeqOf::InsertBeforeAndCopy
3704 // alloc new list elmt, insert it after the
3705 // current element, copy given elmt in to new elmt
3706 // and return the component type
3707 // if the current element is null, the new element
3708 // is placed at the end of the list.
3709 CRLToSignSeqOf
&CRLToSignSeqOf::InsertAfterAndCopy (CRLToSignSeqOfSeq
&elmt
)
3711 AsnListElmt
*newElmt
;
3713 newElmt
= new AsnListElmt
;
3714 newElmt
->elmt
= new CRLToSignSeqOfSeq
;
3715 *newElmt
->elmt
= elmt
;
3718 newElmt
->prev
= last
;
3719 newElmt
->next
= NULL
;
3726 newElmt
->prev
= curr
;
3727 newElmt
->next
= curr
->next
;
3728 curr
->next
= newElmt
;
3732 newElmt
->next
->prev
= newElmt
;
3736 } // CRLToSignSeqOf::InsertAfterAndCopy
3739 // remove current element from list if current element is not NULL
3740 // The new current element will be the next element.
3741 // If the current element is the last element in the list
3742 // the second but last element will become the new current element.
3743 void CRLToSignSeqOf::RemoveCurrFromList()
3745 AsnListElmt
*del_elmt
;
3753 first
= last
= curr
= NULL
;
3754 else if (curr
== first
)
3756 curr
= first
= first
->next
;
3759 else if (curr
== last
)
3761 curr
= last
= last
->prev
;
3766 curr
->prev
->next
= curr
->next
;
3767 curr
->next
->prev
= curr
->prev
;
3770 delete del_elmt
->elmt
;
3776 AsnLen
CRLToSignSeqOf::BEncContent (BUF_TYPE b
)
3778 AsnListElmt
*currElmt
;
3780 AsnLen totalLen
= 0;
3781 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
3784 elmtLen
= currElmt
->elmt
->BEncContent (b
);
3785 elmtLen
+= BEncConsLen (b
, elmtLen
);
3787 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3788 totalLen
+= elmtLen
;
3791 } // CRLToSignSeqOf::BEncContent
3794 void CRLToSignSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
3795 AsnLen
&bytesDecoded
, ENV_TYPE env
)
3797 CRLToSignSeqOfSeq
*listElmt
;
3799 AsnLen listBytesDecoded
= 0;
3802 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
3804 tag1
= BDecTag (b
, listBytesDecoded
, env
);
3805 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
3807 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
3810 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3812 Asn1Error
<< "Unexpected Tag" << endl
;
3813 SnaccExcep::throwMe(-140);
3816 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
3817 listElmt
= Append();
3818 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
3821 bytesDecoded
+= listBytesDecoded
;
3822 } // CRLToSignSeqOf::BDecContent
3825 CertificateToSign::CertificateToSign()
3829 signature
= new AlgorithmIdentifier
;
3831 signature
= NULL
; // incomplete initialization of mandatory element!
3836 issuer
= NULL
; // incomplete initialization of mandatory element!
3839 validity
= new Validity
;
3841 validity
= NULL
; // incomplete initialization of mandatory element!
3846 subject
= NULL
; // incomplete initialization of mandatory element!
3849 subjectPublicKeyInfo
= new SubjectPublicKeyInfo
;
3851 subjectPublicKeyInfo
= NULL
; // incomplete initialization of mandatory element!
3853 issuerUniqueIdentifier
= NULL
;
3854 subjectUniqueIdentifier
= NULL
;
3858 CertificateToSign::CertificateToSign (const CertificateToSign
&)
3860 Asn1Error
<< "use of incompletely defined CertificateToSign::CertificateToSign (const CertificateToSign &)" << endl
;
3864 CertificateToSign::~CertificateToSign()
3871 delete subjectPublicKeyInfo
;
3872 delete issuerUniqueIdentifier
;
3873 delete subjectUniqueIdentifier
;
3877 AsnType
*CertificateToSign::Clone() const
3879 return new CertificateToSign
;
3882 AsnType
*CertificateToSign::Copy() const
3884 return new CertificateToSign (*this);
3888 CertificateToSign
&CertificateToSign::operator = (const CertificateToSign
&that
)
3889 #else // SNACC_DEEP_COPY
3890 CertificateToSign
&CertificateToSign::operator = (const CertificateToSign
&)
3891 #endif // SNACC_DEEP_COPY
3899 version
= new Version
;
3900 *version
= *that
.version
;
3907 serialNumber
= that
.serialNumber
;
3911 signature
= new AlgorithmIdentifier
;
3912 *signature
= *that
.signature
;
3923 *issuer
= *that
.issuer
;
3933 validity
= new Validity
;
3934 *validity
= *that
.validity
;
3945 *subject
= *that
.subject
;
3952 if (that
.subjectPublicKeyInfo
)
3954 if (!subjectPublicKeyInfo
)
3955 subjectPublicKeyInfo
= new SubjectPublicKeyInfo
;
3956 *subjectPublicKeyInfo
= *that
.subjectPublicKeyInfo
;
3960 delete subjectPublicKeyInfo
;
3961 subjectPublicKeyInfo
= NULL
;
3963 if (that
.issuerUniqueIdentifier
)
3965 if (!issuerUniqueIdentifier
)
3966 issuerUniqueIdentifier
= new UniqueIdentifier
;
3967 *issuerUniqueIdentifier
= *that
.issuerUniqueIdentifier
;
3971 delete issuerUniqueIdentifier
;
3972 issuerUniqueIdentifier
= NULL
;
3974 if (that
.subjectUniqueIdentifier
)
3976 if (!subjectUniqueIdentifier
)
3977 subjectUniqueIdentifier
= new UniqueIdentifier
;
3978 *subjectUniqueIdentifier
= *that
.subjectUniqueIdentifier
;
3982 delete subjectUniqueIdentifier
;
3983 subjectUniqueIdentifier
= NULL
;
3985 if (that
.extensions
)
3988 extensions
= new Extensions
;
3989 *extensions
= *that
.extensions
;
3999 #else // SNACC_DEEP_COPY
4000 Asn1Error
<< "use of incompletely defined CertificateToSign &CertificateToSign::operator = (const CertificateToSign &)" << endl
;
4002 // if your compiler complains here, check the -novolat option
4003 #endif // SNACC_DEEP_COPY
4007 CertificateToSign::BEncContent (BUF_TYPE b
)
4009 AsnLen totalLen
= 0;
4012 if (NOT_NULL (extensions
))
4016 l
= extensions
->BEncContent (b
);
4017 l
+= BEncConsLen (b
, l
);
4019 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4020 l
+= BEncConsLen (b
, l
);
4022 l
+= BEncTag1 (b
, CNTX
, CONS
, 3);
4026 if (NOT_NULL (subjectUniqueIdentifier
))
4028 l
= subjectUniqueIdentifier
->BEncContent (b
);
4029 l
+= BEncDefLen (b
, l
);
4031 l
+= BEncTag1 (b
, CNTX
, PRIM
, 2);
4035 if (NOT_NULL (issuerUniqueIdentifier
))
4037 l
= issuerUniqueIdentifier
->BEncContent (b
);
4038 l
+= BEncDefLen (b
, l
);
4040 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
4045 l
= subjectPublicKeyInfo
->BEncContent (b
);
4046 l
+= BEncConsLen (b
, l
);
4048 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4051 l
= subject
->BEncContent (b
);
4055 l
= validity
->BEncContent (b
);
4056 l
+= BEncConsLen (b
, l
);
4058 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4061 l
= issuer
->BEncContent (b
);
4065 l
= signature
->BEncContent (b
);
4066 l
+= BEncConsLen (b
, l
);
4068 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4071 l
= serialNumber
.BEncContent (b
);
4072 l
+= BEncDefLen (b
, l
);
4074 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
4077 if (NOT_NULL (version
))
4080 l
= version
->BEncContent (b
);
4081 BEncDefLenTo127 (b
, l
);
4084 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
4085 l
+= BEncConsLen (b
, l
);
4087 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
4092 } // CertificateToSign::BEncContent
4095 void CertificateToSign::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4098 AsnLen seqBytesDecoded
= 0;
4101 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4103 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
4105 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4106 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4108 if (tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))
4110 Asn1Error
<< "Unexpected Tag" << endl
;
4111 SnaccExcep::throwMe(-141);
4114 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
4115 version
= new Version
;
4116 version
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
4117 if (elmtLen1
== INDEFINITE_LEN
)
4118 BDecEoc (b
, seqBytesDecoded
, env
);
4120 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4123 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))
4124 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, INTEGER_TAG_CODE
)))
4126 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4127 serialNumber
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4128 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4132 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4133 SnaccExcep::throwMe(-142);
4136 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4138 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4139 signature
= new AlgorithmIdentifier
;
4140 signature
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4141 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4145 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4146 SnaccExcep::throwMe(-143);
4149 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4151 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4153 issuer
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4154 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4158 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4159 SnaccExcep::throwMe(-144);
4162 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4164 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4165 validity
= new Validity
;
4166 validity
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4167 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4171 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4172 SnaccExcep::throwMe(-145);
4175 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4177 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4179 subject
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4180 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4184 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4185 SnaccExcep::throwMe(-146);
4188 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4190 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4191 subjectPublicKeyInfo
= new SubjectPublicKeyInfo
;
4192 subjectPublicKeyInfo
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4193 if (seqBytesDecoded
== elmtLen0
)
4195 bytesDecoded
+= seqBytesDecoded
;
4200 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4202 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4204 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4205 bytesDecoded
+= seqBytesDecoded
;
4212 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4213 SnaccExcep::throwMe(-147);
4216 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))
4217 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
4219 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4220 issuerUniqueIdentifier
= new UniqueIdentifier
;
4221 issuerUniqueIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4222 if (seqBytesDecoded
== elmtLen0
)
4224 bytesDecoded
+= seqBytesDecoded
;
4229 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4231 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4233 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4234 bytesDecoded
+= seqBytesDecoded
;
4240 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 2))
4241 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2)))
4243 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4244 subjectUniqueIdentifier
= new UniqueIdentifier
;
4245 subjectUniqueIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4246 if (seqBytesDecoded
== elmtLen0
)
4248 bytesDecoded
+= seqBytesDecoded
;
4253 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4255 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4257 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4258 bytesDecoded
+= seqBytesDecoded
;
4264 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 3)))
4266 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4267 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4269 if (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4271 Asn1Error
<< "Unexpected Tag" << endl
;
4272 SnaccExcep::throwMe(-148);
4275 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
4276 extensions
= new Extensions
;
4277 extensions
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
4278 if (elmtLen1
== INDEFINITE_LEN
)
4279 BDecEoc (b
, seqBytesDecoded
, env
);
4283 bytesDecoded
+= seqBytesDecoded
;
4284 if (elmtLen0
== INDEFINITE_LEN
)
4286 BDecEoc (b
, bytesDecoded
, env
);
4289 else if (seqBytesDecoded
!= elmtLen0
)
4291 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4292 SnaccExcep::throwMe(-149);
4296 } // CertificateToSign::BDecContent
4298 AsnLen
CertificateToSign::BEnc (BUF_TYPE b
)
4301 l
= BEncContent (b
);
4302 l
+= BEncConsLen (b
, l
);
4303 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4307 void CertificateToSign::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4312 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4314 Asn1Error
<< "CertificateToSign::BDec: ERROR - wrong tag" << endl
;
4315 SnaccExcep::throwMe(-150);
4317 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4318 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4321 void CertificateToSign::Print (ostream
&os
) const
4324 os
<< "{ -- SEQUENCE --" << endl
;
4325 indentG
+= stdIndentG
;
4327 if (NOT_NULL (version
))
4329 Indent (os
, indentG
);
4335 Indent (os
, indentG
);
4342 Indent (os
, indentG
);
4343 os
<< "serialNumber ";
4348 if (NOT_NULL (signature
))
4350 Indent (os
, indentG
);
4356 Indent (os
, indentG
);
4362 if (NOT_NULL (issuer
))
4364 Indent (os
, indentG
);
4370 Indent (os
, indentG
);
4376 if (NOT_NULL (validity
))
4378 Indent (os
, indentG
);
4384 Indent (os
, indentG
);
4390 if (NOT_NULL (subject
))
4392 Indent (os
, indentG
);
4398 Indent (os
, indentG
);
4404 if (NOT_NULL (subjectPublicKeyInfo
))
4406 Indent (os
, indentG
);
4407 os
<< "subjectPublicKeyInfo ";
4408 os
<< *subjectPublicKeyInfo
;
4412 Indent (os
, indentG
);
4413 os
<< "subjectPublicKeyInfo ";
4418 if (NOT_NULL (issuerUniqueIdentifier
))
4421 Indent (os
, indentG
);
4422 os
<< "issuerUniqueIdentifier ";
4423 os
<< *issuerUniqueIdentifier
;
4427 Indent (os
, indentG
);
4428 os
<< "issuerUniqueIdentifier ";
4433 if (NOT_NULL (subjectUniqueIdentifier
))
4436 Indent (os
, indentG
);
4437 os
<< "subjectUniqueIdentifier ";
4438 os
<< *subjectUniqueIdentifier
;
4442 Indent (os
, indentG
);
4443 os
<< "subjectUniqueIdentifier ";
4448 if (NOT_NULL (extensions
))
4451 Indent (os
, indentG
);
4452 os
<< "extensions ";
4457 Indent (os
, indentG
);
4458 os
<< "extensions ";
4464 indentG
-= stdIndentG
;
4465 Indent (os
, indentG
);
4468 } // CertificateToSign::Print
4471 CRLToSign::CRLToSign()
4475 signature
= new AlgorithmIdentifier
;
4477 signature
= NULL
; // incomplete initialization of mandatory element!
4482 issuer
= NULL
; // incomplete initialization of mandatory element!
4485 thisUpdate
= new Time
;
4487 thisUpdate
= NULL
; // incomplete initialization of mandatory element!
4490 revokedCertificates
= NULL
;
4491 crlExtensions
= NULL
;
4494 CRLToSign::CRLToSign (const CRLToSign
&)
4496 Asn1Error
<< "use of incompletely defined CRLToSign::CRLToSign (const CRLToSign &)" << endl
;
4500 CRLToSign::~CRLToSign()
4507 delete revokedCertificates
;
4508 delete crlExtensions
;
4511 AsnType
*CRLToSign::Clone() const
4513 return new CRLToSign
;
4516 AsnType
*CRLToSign::Copy() const
4518 return new CRLToSign (*this);
4522 CRLToSign
&CRLToSign::operator = (const CRLToSign
&that
)
4523 #else // SNACC_DEEP_COPY
4524 CRLToSign
&CRLToSign::operator = (const CRLToSign
&)
4525 #endif // SNACC_DEEP_COPY
4533 version
= new Version
;
4534 *version
= *that
.version
;
4544 signature
= new AlgorithmIdentifier
;
4545 *signature
= *that
.signature
;
4556 *issuer
= *that
.issuer
;
4563 if (that
.thisUpdate
)
4566 thisUpdate
= new Time
;
4567 *thisUpdate
= *that
.thisUpdate
;
4574 if (that
.nextUpdate
)
4577 nextUpdate
= new Time
;
4578 *nextUpdate
= *that
.nextUpdate
;
4585 if (that
.revokedCertificates
)
4587 if (!revokedCertificates
)
4588 revokedCertificates
= new CRLToSignSeqOf
;
4589 *revokedCertificates
= *that
.revokedCertificates
;
4593 delete revokedCertificates
;
4594 revokedCertificates
= NULL
;
4596 if (that
.crlExtensions
)
4599 crlExtensions
= new Extensions
;
4600 *crlExtensions
= *that
.crlExtensions
;
4604 delete crlExtensions
;
4605 crlExtensions
= NULL
;
4610 #else // SNACC_DEEP_COPY
4611 Asn1Error
<< "use of incompletely defined CRLToSign &CRLToSign::operator = (const CRLToSign &)" << endl
;
4613 // if your compiler complains here, check the -novolat option
4614 #endif // SNACC_DEEP_COPY
4618 CRLToSign::BEncContent (BUF_TYPE b
)
4620 AsnLen totalLen
= 0;
4623 if (NOT_NULL (crlExtensions
))
4627 l
= crlExtensions
->BEncContent (b
);
4628 l
+= BEncConsLen (b
, l
);
4630 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4631 l
+= BEncConsLen (b
, l
);
4633 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
4637 if (NOT_NULL (revokedCertificates
))
4640 l
= revokedCertificates
->BEncContent (b
);
4641 l
+= BEncConsLen (b
, l
);
4643 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4647 if (NOT_NULL (nextUpdate
))
4649 l
= nextUpdate
->BEncContent (b
);
4653 l
= thisUpdate
->BEncContent (b
);
4656 l
= issuer
->BEncContent (b
);
4660 l
= signature
->BEncContent (b
);
4661 l
+= BEncConsLen (b
, l
);
4663 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4666 if (NOT_NULL (version
))
4668 l
= version
->BEncContent (b
);
4669 BEncDefLenTo127 (b
, l
);
4672 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
4677 } // CRLToSign::BEncContent
4680 void CRLToSign::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4683 AsnLen seqBytesDecoded
= 0;
4686 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4688 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
)))
4690 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4691 version
= new Version
;
4692 version
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4693 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4696 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4698 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4699 signature
= new AlgorithmIdentifier
;
4700 signature
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4701 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4705 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4706 SnaccExcep::throwMe(-151);
4709 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4711 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4713 issuer
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4714 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4718 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4719 SnaccExcep::throwMe(-152);
4722 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, UTCTIME_TAG_CODE
))
4723 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, UTCTIME_TAG_CODE
))
4724 || (tag1
== MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
4725 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
4727 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4728 thisUpdate
= new Time
;
4729 thisUpdate
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4730 if (seqBytesDecoded
== elmtLen0
)
4732 bytesDecoded
+= seqBytesDecoded
;
4737 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4739 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4741 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4742 bytesDecoded
+= seqBytesDecoded
;
4749 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4750 SnaccExcep::throwMe(-153);
4753 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, UTCTIME_TAG_CODE
))
4754 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, UTCTIME_TAG_CODE
))
4755 || (tag1
== MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
4756 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
4758 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4759 nextUpdate
= new Time
;
4760 nextUpdate
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4761 if (seqBytesDecoded
== elmtLen0
)
4763 bytesDecoded
+= seqBytesDecoded
;
4768 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4770 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4772 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4773 bytesDecoded
+= seqBytesDecoded
;
4779 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4781 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4782 revokedCertificates
= new CRLToSignSeqOf
;
4783 revokedCertificates
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4784 if (seqBytesDecoded
== elmtLen0
)
4786 bytesDecoded
+= seqBytesDecoded
;
4791 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4793 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4795 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4796 bytesDecoded
+= seqBytesDecoded
;
4802 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
4804 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4805 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4807 if (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4809 Asn1Error
<< "Unexpected Tag" << endl
;
4810 SnaccExcep::throwMe(-154);
4813 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
4814 crlExtensions
= new Extensions
;
4815 crlExtensions
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
4816 if (elmtLen1
== INDEFINITE_LEN
)
4817 BDecEoc (b
, seqBytesDecoded
, env
);
4821 bytesDecoded
+= seqBytesDecoded
;
4822 if (elmtLen0
== INDEFINITE_LEN
)
4824 BDecEoc (b
, bytesDecoded
, env
);
4827 else if (seqBytesDecoded
!= elmtLen0
)
4829 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4830 SnaccExcep::throwMe(-155);
4834 } // CRLToSign::BDecContent
4836 AsnLen
CRLToSign::BEnc (BUF_TYPE b
)
4839 l
= BEncContent (b
);
4840 l
+= BEncConsLen (b
, l
);
4841 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4845 void CRLToSign::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4850 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4852 Asn1Error
<< "CRLToSign::BDec: ERROR - wrong tag" << endl
;
4853 SnaccExcep::throwMe(-156);
4855 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4856 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4859 void CRLToSign::Print (ostream
&os
) const
4862 os
<< "{ -- SEQUENCE --" << endl
;
4863 indentG
+= stdIndentG
;
4865 if (NOT_NULL (version
))
4867 Indent (os
, indentG
);
4873 Indent (os
, indentG
);
4879 if (NOT_NULL (signature
))
4881 Indent (os
, indentG
);
4887 Indent (os
, indentG
);
4893 if (NOT_NULL (issuer
))
4895 Indent (os
, indentG
);
4901 Indent (os
, indentG
);
4907 if (NOT_NULL (thisUpdate
))
4909 Indent (os
, indentG
);
4910 os
<< "thisUpdate ";
4915 Indent (os
, indentG
);
4916 os
<< "thisUpdate ";
4921 if (NOT_NULL (nextUpdate
))
4924 Indent (os
, indentG
);
4925 os
<< "nextUpdate ";
4930 Indent (os
, indentG
);
4931 os
<< "nextUpdate ";
4936 if (NOT_NULL (revokedCertificates
))
4939 Indent (os
, indentG
);
4940 os
<< "revokedCertificates ";
4941 os
<< *revokedCertificates
;
4945 Indent (os
, indentG
);
4946 os
<< "revokedCertificates ";
4951 if (NOT_NULL (crlExtensions
))
4954 Indent (os
, indentG
);
4955 os
<< "crlExtensions ";
4956 os
<< *crlExtensions
;
4960 Indent (os
, indentG
);
4961 os
<< "crlExtensions ";
4967 indentG
-= stdIndentG
;
4968 Indent (os
, indentG
);
4971 } // CRLToSign::Print
4974 AttributeCertificateInfo::AttributeCertificateInfo()
4978 subject
= new AttributeCertificateInfoChoice
;
4980 subject
= NULL
; // incomplete initialization of mandatory element!
4983 signature
= new AlgorithmIdentifier
;
4985 signature
= NULL
; // incomplete initialization of mandatory element!
4988 attCertValidityPeriod
= new AttCertValidityPeriod
;
4990 attCertValidityPeriod
= NULL
; // incomplete initialization of mandatory element!
4992 issuerUniqueID
= NULL
;
4996 AttributeCertificateInfo::AttributeCertificateInfo (const AttributeCertificateInfo
&)
4998 Asn1Error
<< "use of incompletely defined AttributeCertificateInfo::AttributeCertificateInfo (const AttributeCertificateInfo &)" << endl
;
5002 AttributeCertificateInfo::~AttributeCertificateInfo()
5007 delete attCertValidityPeriod
;
5008 delete issuerUniqueID
;
5012 AsnType
*AttributeCertificateInfo::Clone() const
5014 return new AttributeCertificateInfo
;
5017 AsnType
*AttributeCertificateInfo::Copy() const
5019 return new AttributeCertificateInfo (*this);
5023 AttributeCertificateInfo
&AttributeCertificateInfo::operator = (const AttributeCertificateInfo
&that
)
5024 #else // SNACC_DEEP_COPY
5025 AttributeCertificateInfo
&AttributeCertificateInfo::operator = (const AttributeCertificateInfo
&)
5026 #endif // SNACC_DEEP_COPY
5034 version
= new Version
;
5035 *version
= *that
.version
;
5045 subject
= new AttributeCertificateInfoChoice
;
5046 *subject
= *that
.subject
;
5053 issuer
= that
.issuer
;
5057 signature
= new AlgorithmIdentifier
;
5058 *signature
= *that
.signature
;
5065 serialNumber
= that
.serialNumber
;
5066 if (that
.attCertValidityPeriod
)
5068 if (!attCertValidityPeriod
)
5069 attCertValidityPeriod
= new AttCertValidityPeriod
;
5070 *attCertValidityPeriod
= *that
.attCertValidityPeriod
;
5074 delete attCertValidityPeriod
;
5075 attCertValidityPeriod
= NULL
;
5077 attributes
= that
.attributes
;
5078 if (that
.issuerUniqueID
)
5080 if (!issuerUniqueID
)
5081 issuerUniqueID
= new UniqueIdentifier
;
5082 *issuerUniqueID
= *that
.issuerUniqueID
;
5086 delete issuerUniqueID
;
5087 issuerUniqueID
= NULL
;
5089 if (that
.extensions
)
5092 extensions
= new Extensions
;
5093 *extensions
= *that
.extensions
;
5103 #else // SNACC_DEEP_COPY
5104 Asn1Error
<< "use of incompletely defined AttributeCertificateInfo &AttributeCertificateInfo::operator = (const AttributeCertificateInfo &)" << endl
;
5106 // if your compiler complains here, check the -novolat option
5107 #endif // SNACC_DEEP_COPY
5111 AttributeCertificateInfo::BEncContent (BUF_TYPE b
)
5113 AsnLen totalLen
= 0;
5116 if (NOT_NULL (extensions
))
5119 l
= extensions
->BEncContent (b
);
5120 l
+= BEncConsLen (b
, l
);
5122 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5126 if (NOT_NULL (issuerUniqueID
))
5128 l
= issuerUniqueID
->BEncContent (b
);
5129 l
+= BEncDefLen (b
, l
);
5131 l
+= BEncTag1 (b
, UNIV
, PRIM
, BITSTRING_TAG_CODE
);
5136 l
= attributes
.BEncContent (b
);
5137 l
+= BEncConsLen (b
, l
);
5139 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5143 l
= attCertValidityPeriod
->BEncContent (b
);
5144 l
+= BEncConsLen (b
, l
);
5146 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5149 l
= serialNumber
.BEncContent (b
);
5150 l
+= BEncDefLen (b
, l
);
5152 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
5156 l
= signature
->BEncContent (b
);
5157 l
+= BEncConsLen (b
, l
);
5159 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5163 l
= issuer
.BEncContent (b
);
5164 l
+= BEncConsLen (b
, l
);
5166 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5169 l
= subject
->BEncContent (b
);
5172 if (NOT_NULL (version
))
5174 l
= version
->BEncContent (b
);
5175 BEncDefLenTo127 (b
, l
);
5178 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
5183 } // AttributeCertificateInfo::BEncContent
5186 void AttributeCertificateInfo::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5189 AsnLen seqBytesDecoded
= 0;
5191 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5193 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
)))
5195 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5196 version
= new Version
;
5197 version
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5198 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5201 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0))
5202 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
5204 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5205 subject
= new AttributeCertificateInfoChoice
;
5206 subject
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5207 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5211 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5212 SnaccExcep::throwMe(-157);
5215 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
5217 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5218 issuer
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5219 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5223 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5224 SnaccExcep::throwMe(-158);
5227 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
5229 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5230 signature
= new AlgorithmIdentifier
;
5231 signature
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5232 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5236 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5237 SnaccExcep::throwMe(-159);
5240 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
))
5241 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, INTEGER_TAG_CODE
)))
5243 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5244 serialNumber
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5245 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5249 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5250 SnaccExcep::throwMe(-160);
5253 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
5255 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5256 attCertValidityPeriod
= new AttCertValidityPeriod
;
5257 attCertValidityPeriod
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5258 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5262 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5263 SnaccExcep::throwMe(-161);
5266 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
5268 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5269 attributes
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5270 if (seqBytesDecoded
== elmtLen0
)
5272 bytesDecoded
+= seqBytesDecoded
;
5277 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5279 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5281 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5282 bytesDecoded
+= seqBytesDecoded
;
5289 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5290 SnaccExcep::throwMe(-162);
5293 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BITSTRING_TAG_CODE
))
5294 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, BITSTRING_TAG_CODE
)))
5296 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5297 issuerUniqueID
= new UniqueIdentifier
;
5298 issuerUniqueID
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5299 if (seqBytesDecoded
== elmtLen0
)
5301 bytesDecoded
+= seqBytesDecoded
;
5306 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5308 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5310 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5311 bytesDecoded
+= seqBytesDecoded
;
5317 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
5319 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5320 extensions
= new Extensions
;
5321 extensions
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5324 bytesDecoded
+= seqBytesDecoded
;
5325 if (elmtLen0
== INDEFINITE_LEN
)
5327 BDecEoc (b
, bytesDecoded
, env
);
5330 else if (seqBytesDecoded
!= elmtLen0
)
5332 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5333 SnaccExcep::throwMe(-163);
5337 } // AttributeCertificateInfo::BDecContent
5339 AsnLen
AttributeCertificateInfo::BEnc (BUF_TYPE b
)
5342 l
= BEncContent (b
);
5343 l
+= BEncConsLen (b
, l
);
5344 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5348 void AttributeCertificateInfo::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5353 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5355 Asn1Error
<< "AttributeCertificateInfo::BDec: ERROR - wrong tag" << endl
;
5356 SnaccExcep::throwMe(-164);
5358 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5359 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5362 void AttributeCertificateInfo::Print (ostream
&os
) const
5365 os
<< "{ -- SEQUENCE --" << endl
;
5366 indentG
+= stdIndentG
;
5368 if (NOT_NULL (version
))
5370 Indent (os
, indentG
);
5376 Indent (os
, indentG
);
5382 if (NOT_NULL (subject
))
5384 Indent (os
, indentG
);
5390 Indent (os
, indentG
);
5397 Indent (os
, indentG
);
5403 if (NOT_NULL (signature
))
5405 Indent (os
, indentG
);
5411 Indent (os
, indentG
);
5418 Indent (os
, indentG
);
5419 os
<< "serialNumber ";
5424 if (NOT_NULL (attCertValidityPeriod
))
5426 Indent (os
, indentG
);
5427 os
<< "attCertValidityPeriod ";
5428 os
<< *attCertValidityPeriod
;
5432 Indent (os
, indentG
);
5433 os
<< "attCertValidityPeriod ";
5439 Indent (os
, indentG
);
5440 os
<< "attributes ";
5445 if (NOT_NULL (issuerUniqueID
))
5448 Indent (os
, indentG
);
5449 os
<< "issuerUniqueID ";
5450 os
<< *issuerUniqueID
;
5454 Indent (os
, indentG
);
5455 os
<< "issuerUniqueID ";
5460 if (NOT_NULL (extensions
))
5463 Indent (os
, indentG
);
5464 os
<< "extensions ";
5469 Indent (os
, indentG
);
5470 os
<< "extensions ";
5476 indentG
-= stdIndentG
;
5477 Indent (os
, indentG
);
5480 } // AttributeCertificateInfo::Print
5483 Certificate::Certificate()
5486 certificateToSign
= new CertificateToSign
;
5488 certificateToSign
= NULL
; // incomplete initialization of mandatory element!
5491 algorithmIdentifier
= new AlgorithmIdentifier
;
5493 algorithmIdentifier
= NULL
; // incomplete initialization of mandatory element!
5497 Certificate::Certificate (const Certificate
&)
5499 Asn1Error
<< "use of incompletely defined Certificate::Certificate (const Certificate &)" << endl
;
5503 Certificate::~Certificate()
5505 delete certificateToSign
;
5506 delete algorithmIdentifier
;
5509 AsnType
*Certificate::Clone() const
5511 return new Certificate
;
5514 AsnType
*Certificate::Copy() const
5516 return new Certificate (*this);
5520 Certificate
&Certificate::operator = (const Certificate
&that
)
5521 #else // SNACC_DEEP_COPY
5522 Certificate
&Certificate::operator = (const Certificate
&)
5523 #endif // SNACC_DEEP_COPY
5528 if (that
.certificateToSign
)
5530 if (!certificateToSign
)
5531 certificateToSign
= new CertificateToSign
;
5532 *certificateToSign
= *that
.certificateToSign
;
5536 delete certificateToSign
;
5537 certificateToSign
= NULL
;
5539 if (that
.algorithmIdentifier
)
5541 if (!algorithmIdentifier
)
5542 algorithmIdentifier
= new AlgorithmIdentifier
;
5543 *algorithmIdentifier
= *that
.algorithmIdentifier
;
5547 delete algorithmIdentifier
;
5548 algorithmIdentifier
= NULL
;
5550 signatureValue
= that
.signatureValue
;
5554 #else // SNACC_DEEP_COPY
5555 Asn1Error
<< "use of incompletely defined Certificate &Certificate::operator = (const Certificate &)" << endl
;
5557 // if your compiler complains here, check the -novolat option
5558 #endif // SNACC_DEEP_COPY
5562 Certificate::BEncContent (BUF_TYPE b
)
5564 AsnLen totalLen
= 0;
5567 l
= signatureValue
.BEncContent (b
);
5568 l
+= BEncDefLen (b
, l
);
5570 l
+= BEncTag1 (b
, UNIV
, PRIM
, BITSTRING_TAG_CODE
);
5574 l
= algorithmIdentifier
->BEncContent (b
);
5575 l
+= BEncConsLen (b
, l
);
5577 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5581 l
= certificateToSign
->BEncContent (b
);
5582 l
+= BEncConsLen (b
, l
);
5584 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5588 } // Certificate::BEncContent
5591 void Certificate::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5594 AsnLen seqBytesDecoded
= 0;
5596 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5598 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
5600 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5601 certificateToSign
= new CertificateToSign
;
5602 certificateToSign
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5603 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5607 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5608 SnaccExcep::throwMe(-165);
5611 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
5613 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5614 algorithmIdentifier
= new AlgorithmIdentifier
;
5615 algorithmIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5616 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5620 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5621 SnaccExcep::throwMe(-166);
5624 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BITSTRING_TAG_CODE
))
5625 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, BITSTRING_TAG_CODE
)))
5627 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5628 signatureValue
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5632 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
5633 SnaccExcep::throwMe(-167);
5636 bytesDecoded
+= seqBytesDecoded
;
5637 if (elmtLen0
== INDEFINITE_LEN
)
5639 BDecEoc (b
, bytesDecoded
, env
);
5642 else if (seqBytesDecoded
!= elmtLen0
)
5644 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5645 SnaccExcep::throwMe(-168);
5649 } // Certificate::BDecContent
5651 AsnLen
Certificate::BEnc (BUF_TYPE b
)
5654 l
= BEncContent (b
);
5655 l
+= BEncConsLen (b
, l
);
5656 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5660 void Certificate::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5665 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5667 Asn1Error
<< "Certificate::BDec: ERROR - wrong tag" << endl
;
5668 SnaccExcep::throwMe(-169);
5670 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5671 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5674 void Certificate::Print (ostream
&os
) const
5677 os
<< "{ -- SEQUENCE --" << endl
;
5678 indentG
+= stdIndentG
;
5680 if (NOT_NULL (certificateToSign
))
5682 Indent (os
, indentG
);
5683 os
<< "certificateToSign ";
5684 os
<< *certificateToSign
;
5688 Indent (os
, indentG
);
5689 os
<< "certificateToSign ";
5694 if (NOT_NULL (algorithmIdentifier
))
5696 Indent (os
, indentG
);
5697 os
<< "algorithmIdentifier ";
5698 os
<< *algorithmIdentifier
;
5702 Indent (os
, indentG
);
5703 os
<< "algorithmIdentifier ";
5709 Indent (os
, indentG
);
5710 os
<< "signatureValue ";
5711 os
<< signatureValue
;
5715 indentG
-= stdIndentG
;
5716 Indent (os
, indentG
);
5719 } // Certificate::Print
5722 AsnType
*CrossCertificates::Clone() const
5724 return new CrossCertificates
;
5727 AsnType
*CrossCertificates::Copy() const
5729 return new CrossCertificates (*this);
5732 AsnLen
CrossCertificates::BEnc (BUF_TYPE b
)
5735 l
= BEncContent (b
);
5736 l
+= BEncConsLen (b
, l
);
5737 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
5741 void CrossCertificates::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5746 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
5748 Asn1Error
<< "CrossCertificates::BDec: ERROR - wrong tag" << endl
;
5749 SnaccExcep::throwMe(-170);
5751 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5752 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5755 CrossCertificates::CrossCertificates (const CrossCertificates
&)
5757 Asn1Error
<< "use of incompletely defined CrossCertificates::CrossCertificates (const CrossCertificates &)" << endl
;
5761 CrossCertificates::~CrossCertificates()
5764 for (; Curr() != NULL
; RemoveCurrFromList())
5766 } // end of destructor
5769 CrossCertificates
&CrossCertificates::operator = (const CrossCertificates
&that
)
5770 #else // SNACC_DEEP_COPY
5771 CrossCertificates
&CrossCertificates::operator = (const CrossCertificates
&)
5772 #endif // SNACC_DEEP_COPY
5778 for (; Curr(); RemoveCurrFromList())
5781 //that.SetCurrToFirst();
5782 //for (; that.Curr(); that.GoNext())
5783 // AppendCopy (*that.Curr());
5784 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
5785 AppendCopy (*run
->elmt
);
5789 #else // SNACC_DEEP_COPY
5790 Asn1Error
<< "use of incompletely defined CrossCertificates &CrossCertificates::operator = (const CrossCertificates &)" << endl
;
5792 // if your compiler complains here, check the -novolat option
5793 #endif // SNACC_DEEP_COPY
5796 void CrossCertificates::Print (ostream
&os
) const
5799 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
5800 indentG
+= stdIndentG
;
5802 //for (; Curr() != NULL; GoNext())
5803 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
5805 Indent (os
, indentG
);
5808 //if (Curr() != Last())
5813 indentG
-= stdIndentG
;
5814 Indent (os
, indentG
);
5822 void CrossCertificates::SetCurrElmt (unsigned long int index
)
5824 unsigned long int i
;
5827 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
5829 } // CrossCertificates::SetCurrElmt
5832 unsigned long int CrossCertificates::GetCurrElmtIndex()
5834 unsigned long int i
;
5838 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
5847 } // CrossCertificates::GetCurrElmtIndex
5850 // alloc new list elmt, put at end of list
5851 // and return the component type
5852 Certificate
*CrossCertificates::Append()
5854 AsnListElmt
*newElmt
;
5855 newElmt
= new AsnListElmt
;
5856 newElmt
->elmt
= new Certificate
;
5857 newElmt
->next
= NULL
;
5860 newElmt
->prev
= NULL
;
5861 first
= last
= newElmt
;
5865 newElmt
->prev
= last
;
5866 last
->next
= newElmt
;
5870 return (curr
= newElmt
)->elmt
;
5871 } // CrossCertificates::Append
5874 // alloc new list elmt, put at begining of list
5875 // and return the component type
5876 Certificate
*CrossCertificates::Prepend()
5878 AsnListElmt
*newElmt
;
5879 newElmt
= new AsnListElmt
;
5880 newElmt
->elmt
= new Certificate
;
5881 newElmt
->prev
= NULL
;
5884 newElmt
->next
= NULL
;
5885 first
= last
= newElmt
;
5889 newElmt
->next
= first
;
5890 first
->prev
= newElmt
;
5894 return (curr
= newElmt
)->elmt
;
5895 } // CrossCertificates::Prepend
5898 // alloc new list elmt, insert it before the
5899 // current element and return the component type
5900 // if the current element is null, the new element
5901 // is placed at the beginning of the list.
5902 Certificate
*CrossCertificates::InsertBefore()
5904 AsnListElmt
*newElmt
;
5905 newElmt
= new AsnListElmt
;
5906 newElmt
->elmt
= new Certificate
;
5909 newElmt
->next
= first
;
5910 newElmt
->prev
= NULL
;
5917 newElmt
->next
= curr
;
5918 newElmt
->prev
= curr
->prev
;
5919 curr
->prev
= newElmt
;
5923 newElmt
->prev
->next
= newElmt
;
5926 return (curr
= newElmt
)->elmt
;
5927 } // CrossCertificates::InsertBefore
5930 // alloc new list elmt, insert it after the
5931 // current element and return the component type
5932 // if the current element is null, the new element
5933 // is placed at the end of the list.
5934 Certificate
*CrossCertificates::InsertAfter()
5936 AsnListElmt
*newElmt
;
5937 newElmt
= new AsnListElmt
;
5938 newElmt
->elmt
= new Certificate
;
5941 newElmt
->prev
= last
;
5942 newElmt
->next
= NULL
;
5949 newElmt
->prev
= curr
;
5950 newElmt
->next
= curr
->next
;
5951 curr
->next
= newElmt
;
5955 newElmt
->next
->prev
= newElmt
;
5958 return (curr
= newElmt
)->elmt
;
5959 } // CrossCertificates::InsertAfter
5962 CrossCertificates
&CrossCertificates::AppendCopy (Certificate
&elmt
)
5964 AsnListElmt
*newElmt
;
5965 newElmt
= new AsnListElmt
;
5966 newElmt
->elmt
= new Certificate
;
5967 *newElmt
->elmt
= elmt
;
5968 newElmt
->next
= NULL
;
5971 newElmt
->prev
= NULL
;
5972 first
= last
= newElmt
;
5976 newElmt
->prev
= last
;
5977 last
->next
= newElmt
;
5985 CrossCertificates
&CrossCertificates::PrependCopy (Certificate
&elmt
)
5987 AsnListElmt
*newElmt
;
5988 newElmt
= new AsnListElmt
;
5989 newElmt
->elmt
= new Certificate
;
5990 *newElmt
->elmt
= elmt
;
5991 newElmt
->prev
= NULL
;
5994 newElmt
->next
= NULL
;
5995 first
= last
= newElmt
;
5999 newElmt
->next
= first
;
6000 first
->prev
= newElmt
;
6005 } // CrossCertificates::PrependCopy
6008 // alloc new list elmt, insert it before the
6009 // current element, copy the given elmt into the new elmt
6010 // and return the component type.
6011 // if the current element is null, the new element
6012 // is placed at the beginning of the list.
6013 CrossCertificates
&CrossCertificates::InsertBeforeAndCopy (Certificate
&elmt
)
6015 AsnListElmt
*newElmt
;
6017 newElmt
= new AsnListElmt
;
6018 newElmt
->elmt
= new Certificate
;
6019 *newElmt
->elmt
= elmt
;
6023 newElmt
->next
= first
;
6024 newElmt
->prev
= NULL
;
6031 newElmt
->next
= curr
;
6032 newElmt
->prev
= curr
->prev
;
6033 curr
->prev
= newElmt
;
6037 newElmt
->prev
->next
= newElmt
;
6041 } // CrossCertificates::InsertBeforeAndCopy
6044 // alloc new list elmt, insert it after the
6045 // current element, copy given elmt in to new elmt
6046 // and return the component type
6047 // if the current element is null, the new element
6048 // is placed at the end of the list.
6049 CrossCertificates
&CrossCertificates::InsertAfterAndCopy (Certificate
&elmt
)
6051 AsnListElmt
*newElmt
;
6053 newElmt
= new AsnListElmt
;
6054 newElmt
->elmt
= new Certificate
;
6055 *newElmt
->elmt
= elmt
;
6058 newElmt
->prev
= last
;
6059 newElmt
->next
= NULL
;
6066 newElmt
->prev
= curr
;
6067 newElmt
->next
= curr
->next
;
6068 curr
->next
= newElmt
;
6072 newElmt
->next
->prev
= newElmt
;
6076 } // CrossCertificates::InsertAfterAndCopy
6079 // remove current element from list if current element is not NULL
6080 // The new current element will be the next element.
6081 // If the current element is the last element in the list
6082 // the second but last element will become the new current element.
6083 void CrossCertificates::RemoveCurrFromList()
6085 AsnListElmt
*del_elmt
;
6093 first
= last
= curr
= NULL
;
6094 else if (curr
== first
)
6096 curr
= first
= first
->next
;
6099 else if (curr
== last
)
6101 curr
= last
= last
->prev
;
6106 curr
->prev
->next
= curr
->next
;
6107 curr
->next
->prev
= curr
->prev
;
6110 delete del_elmt
->elmt
;
6116 AsnLen
CrossCertificates::BEncContent (BUF_TYPE b
)
6118 AsnListElmt
*currElmt
;
6120 AsnLen totalLen
= 0;
6123 CSM_Buffer
**tmpEnc
=NULL
;
6124 for (currElmt
= last
,icount
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
, icount
++);
6125 tmpEnc
= (CSM_Buffer
**) calloc(sizeof(CSM_Buffer
*), icount
);
6126 for (currElmt
= last
, iii
=0; currElmt
!= NULL
; currElmt
= currElmt
->prev
,iii
++,elmtLen
=0)
6129 ENCODE_BUF1(currElmt
->elmt
->BEncContent
, elmtLen
);
6130 elmtLen
+= BEncConsLen (outputBuf
, elmtLen
);
6132 elmtLen
+= BEncTag1 (outputBuf
, UNIV
, CONS
, SEQ_TAG_CODE
);
6133 ENCODE_BUF2(tmpEnc
[iii
]);
6135 vdasnacc_sortSetOf(tmpEnc
, icount
);
6136 for (iii
=0,elmtLen
=0; iii
< icount
; elmtLen
+=tmpEnc
[iii
++]->Length())
6137 SM_WriteToAsnBuf(tmpEnc
[iii
], b
);
6138 for (iii
=0; iii
< icount
; iii
++) delete tmpEnc
[iii
];
6141 totalLen
+= elmtLen
;
6143 } // CrossCertificates::BEncContent
6146 void CrossCertificates::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
6147 AsnLen
&bytesDecoded
, ENV_TYPE env
)
6149 Certificate
*listElmt
;
6151 AsnLen listBytesDecoded
= 0;
6154 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
6156 tag1
= BDecTag (b
, listBytesDecoded
, env
);
6157 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
6159 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
6162 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6164 Asn1Error
<< "Unexpected Tag" << endl
;
6165 SnaccExcep::throwMe(-171);
6168 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
6169 listElmt
= Append();
6170 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
6173 bytesDecoded
+= listBytesDecoded
;
6174 } // CrossCertificates::BDecContent
6177 CertificatePair::CertificatePair()
6183 CertificatePair::CertificatePair (const CertificatePair
&)
6185 Asn1Error
<< "use of incompletely defined CertificatePair::CertificatePair (const CertificatePair &)" << endl
;
6189 CertificatePair::~CertificatePair()
6195 AsnType
*CertificatePair::Clone() const
6197 return new CertificatePair
;
6200 AsnType
*CertificatePair::Copy() const
6202 return new CertificatePair (*this);
6206 CertificatePair
&CertificatePair::operator = (const CertificatePair
&that
)
6207 #else // SNACC_DEEP_COPY
6208 CertificatePair
&CertificatePair::operator = (const CertificatePair
&)
6209 #endif // SNACC_DEEP_COPY
6217 forward
= new Certificate
;
6218 *forward
= *that
.forward
;
6228 reverse
= new Certificate
;
6229 *reverse
= *that
.reverse
;
6239 #else // SNACC_DEEP_COPY
6240 Asn1Error
<< "use of incompletely defined CertificatePair &CertificatePair::operator = (const CertificatePair &)" << endl
;
6242 // if your compiler complains here, check the -novolat option
6243 #endif // SNACC_DEEP_COPY
6247 CertificatePair::BEncContent (BUF_TYPE b
)
6249 AsnLen totalLen
= 0;
6252 if (NOT_NULL (reverse
))
6256 l
= reverse
->BEncContent (b
);
6257 l
+= BEncConsLen (b
, l
);
6259 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6260 l
+= BEncConsLen (b
, l
);
6262 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
6266 if (NOT_NULL (forward
))
6270 l
= forward
->BEncContent (b
);
6271 l
+= BEncConsLen (b
, l
);
6273 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6274 l
+= BEncConsLen (b
, l
);
6276 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
6281 } // CertificatePair::BEncContent
6284 void CertificatePair::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6287 AsnLen seqBytesDecoded
= 0;
6294 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6296 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6298 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6299 bytesDecoded
+= seqBytesDecoded
;
6304 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
6306 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6307 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6309 if (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6311 Asn1Error
<< "Unexpected Tag" << endl
;
6312 SnaccExcep::throwMe(-172);
6315 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
6316 forward
= new Certificate
;
6317 forward
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
6318 if (elmtLen1
== INDEFINITE_LEN
)
6319 BDecEoc (b
, seqBytesDecoded
, env
);
6321 if (seqBytesDecoded
== elmtLen0
)
6323 bytesDecoded
+= seqBytesDecoded
;
6328 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6330 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6332 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6333 bytesDecoded
+= seqBytesDecoded
;
6339 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
6341 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6342 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6344 if (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6346 Asn1Error
<< "Unexpected Tag" << endl
;
6347 SnaccExcep::throwMe(-173);
6350 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
6351 reverse
= new Certificate
;
6352 reverse
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
6353 if (elmtLen1
== INDEFINITE_LEN
)
6354 BDecEoc (b
, seqBytesDecoded
, env
);
6358 bytesDecoded
+= seqBytesDecoded
;
6359 if (elmtLen0
== INDEFINITE_LEN
)
6361 BDecEoc (b
, bytesDecoded
, env
);
6364 else if (seqBytesDecoded
!= elmtLen0
)
6366 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
6367 SnaccExcep::throwMe(-174);
6371 } // CertificatePair::BDecContent
6373 AsnLen
CertificatePair::BEnc (BUF_TYPE b
)
6376 l
= BEncContent (b
);
6377 l
+= BEncConsLen (b
, l
);
6378 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6382 void CertificatePair::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6387 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6389 Asn1Error
<< "CertificatePair::BDec: ERROR - wrong tag" << endl
;
6390 SnaccExcep::throwMe(-175);
6392 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6393 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6396 void CertificatePair::Print (ostream
&os
) const
6399 int nonePrinted
= true;
6400 os
<< "{ -- SEQUENCE --" << endl
;
6401 indentG
+= stdIndentG
;
6403 if (NOT_NULL (forward
))
6405 nonePrinted
= false;
6406 Indent (os
, indentG
);
6412 Indent (os
, indentG
);
6418 if (NOT_NULL (reverse
))
6422 nonePrinted
= false;
6423 Indent (os
, indentG
);
6429 Indent (os
, indentG
);
6436 indentG
-= stdIndentG
;
6437 Indent (os
, indentG
);
6440 } // CertificatePair::Print
6443 CertificateList::CertificateList()
6446 crlToSign
= new CRLToSign
;
6448 crlToSign
= NULL
; // incomplete initialization of mandatory element!
6451 algorithmIdentifier
= new AlgorithmIdentifier
;
6453 algorithmIdentifier
= NULL
; // incomplete initialization of mandatory element!
6457 CertificateList::CertificateList (const CertificateList
&)
6459 Asn1Error
<< "use of incompletely defined CertificateList::CertificateList (const CertificateList &)" << endl
;
6463 CertificateList::~CertificateList()
6466 delete algorithmIdentifier
;
6469 AsnType
*CertificateList::Clone() const
6471 return new CertificateList
;
6474 AsnType
*CertificateList::Copy() const
6476 return new CertificateList (*this);
6480 CertificateList
&CertificateList::operator = (const CertificateList
&that
)
6481 #else // SNACC_DEEP_COPY
6482 CertificateList
&CertificateList::operator = (const CertificateList
&)
6483 #endif // SNACC_DEEP_COPY
6491 crlToSign
= new CRLToSign
;
6492 *crlToSign
= *that
.crlToSign
;
6499 if (that
.algorithmIdentifier
)
6501 if (!algorithmIdentifier
)
6502 algorithmIdentifier
= new AlgorithmIdentifier
;
6503 *algorithmIdentifier
= *that
.algorithmIdentifier
;
6507 delete algorithmIdentifier
;
6508 algorithmIdentifier
= NULL
;
6510 signatureValue
= that
.signatureValue
;
6514 #else // SNACC_DEEP_COPY
6515 Asn1Error
<< "use of incompletely defined CertificateList &CertificateList::operator = (const CertificateList &)" << endl
;
6517 // if your compiler complains here, check the -novolat option
6518 #endif // SNACC_DEEP_COPY
6522 CertificateList::BEncContent (BUF_TYPE b
)
6524 AsnLen totalLen
= 0;
6527 l
= signatureValue
.BEncContent (b
);
6528 l
+= BEncDefLen (b
, l
);
6530 l
+= BEncTag1 (b
, UNIV
, PRIM
, BITSTRING_TAG_CODE
);
6534 l
= algorithmIdentifier
->BEncContent (b
);
6535 l
+= BEncConsLen (b
, l
);
6537 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6541 l
= crlToSign
->BEncContent (b
);
6542 l
+= BEncConsLen (b
, l
);
6544 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6548 } // CertificateList::BEncContent
6551 void CertificateList::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6554 AsnLen seqBytesDecoded
= 0;
6556 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6558 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6560 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6561 crlToSign
= new CRLToSign
;
6562 crlToSign
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6563 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6567 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
6568 SnaccExcep::throwMe(-176);
6571 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6573 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6574 algorithmIdentifier
= new AlgorithmIdentifier
;
6575 algorithmIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6576 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6580 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
6581 SnaccExcep::throwMe(-177);
6584 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BITSTRING_TAG_CODE
))
6585 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, BITSTRING_TAG_CODE
)))
6587 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6588 signatureValue
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6592 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
6593 SnaccExcep::throwMe(-178);
6596 bytesDecoded
+= seqBytesDecoded
;
6597 if (elmtLen0
== INDEFINITE_LEN
)
6599 BDecEoc (b
, bytesDecoded
, env
);
6602 else if (seqBytesDecoded
!= elmtLen0
)
6604 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
6605 SnaccExcep::throwMe(-179);
6609 } // CertificateList::BDecContent
6611 AsnLen
CertificateList::BEnc (BUF_TYPE b
)
6614 l
= BEncContent (b
);
6615 l
+= BEncConsLen (b
, l
);
6616 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6620 void CertificateList::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6625 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6627 Asn1Error
<< "CertificateList::BDec: ERROR - wrong tag" << endl
;
6628 SnaccExcep::throwMe(-180);
6630 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6631 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6634 void CertificateList::Print (ostream
&os
) const
6637 os
<< "{ -- SEQUENCE --" << endl
;
6638 indentG
+= stdIndentG
;
6640 if (NOT_NULL (crlToSign
))
6642 Indent (os
, indentG
);
6648 Indent (os
, indentG
);
6654 if (NOT_NULL (algorithmIdentifier
))
6656 Indent (os
, indentG
);
6657 os
<< "algorithmIdentifier ";
6658 os
<< *algorithmIdentifier
;
6662 Indent (os
, indentG
);
6663 os
<< "algorithmIdentifier ";
6669 Indent (os
, indentG
);
6670 os
<< "signatureValue ";
6671 os
<< signatureValue
;
6675 indentG
-= stdIndentG
;
6676 Indent (os
, indentG
);
6679 } // CertificateList::Print
6682 AttributeCertificate::AttributeCertificate()
6685 attributeCertificateInfo
= new AttributeCertificateInfo
;
6687 attributeCertificateInfo
= NULL
; // incomplete initialization of mandatory element!
6690 algorithmIdentifier
= new AlgorithmIdentifier
;
6692 algorithmIdentifier
= NULL
; // incomplete initialization of mandatory element!
6696 AttributeCertificate::AttributeCertificate (const AttributeCertificate
&)
6698 Asn1Error
<< "use of incompletely defined AttributeCertificate::AttributeCertificate (const AttributeCertificate &)" << endl
;
6702 AttributeCertificate::~AttributeCertificate()
6704 delete attributeCertificateInfo
;
6705 delete algorithmIdentifier
;
6708 AsnType
*AttributeCertificate::Clone() const
6710 return new AttributeCertificate
;
6713 AsnType
*AttributeCertificate::Copy() const
6715 return new AttributeCertificate (*this);
6719 AttributeCertificate
&AttributeCertificate::operator = (const AttributeCertificate
&that
)
6720 #else // SNACC_DEEP_COPY
6721 AttributeCertificate
&AttributeCertificate::operator = (const AttributeCertificate
&)
6722 #endif // SNACC_DEEP_COPY
6727 if (that
.attributeCertificateInfo
)
6729 if (!attributeCertificateInfo
)
6730 attributeCertificateInfo
= new AttributeCertificateInfo
;
6731 *attributeCertificateInfo
= *that
.attributeCertificateInfo
;
6735 delete attributeCertificateInfo
;
6736 attributeCertificateInfo
= NULL
;
6738 if (that
.algorithmIdentifier
)
6740 if (!algorithmIdentifier
)
6741 algorithmIdentifier
= new AlgorithmIdentifier
;
6742 *algorithmIdentifier
= *that
.algorithmIdentifier
;
6746 delete algorithmIdentifier
;
6747 algorithmIdentifier
= NULL
;
6749 signatureValue
= that
.signatureValue
;
6753 #else // SNACC_DEEP_COPY
6754 Asn1Error
<< "use of incompletely defined AttributeCertificate &AttributeCertificate::operator = (const AttributeCertificate &)" << endl
;
6756 // if your compiler complains here, check the -novolat option
6757 #endif // SNACC_DEEP_COPY
6761 AttributeCertificate::BEncContent (BUF_TYPE b
)
6763 AsnLen totalLen
= 0;
6766 l
= signatureValue
.BEncContent (b
);
6767 l
+= BEncDefLen (b
, l
);
6769 l
+= BEncTag1 (b
, UNIV
, PRIM
, BITSTRING_TAG_CODE
);
6773 l
= algorithmIdentifier
->BEncContent (b
);
6774 l
+= BEncConsLen (b
, l
);
6776 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6780 l
= attributeCertificateInfo
->BEncContent (b
);
6781 l
+= BEncConsLen (b
, l
);
6783 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6787 } // AttributeCertificate::BEncContent
6790 void AttributeCertificate::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6793 AsnLen seqBytesDecoded
= 0;
6795 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6797 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6799 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6800 attributeCertificateInfo
= new AttributeCertificateInfo
;
6801 attributeCertificateInfo
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6802 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6806 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
6807 SnaccExcep::throwMe(-181);
6810 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6812 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6813 algorithmIdentifier
= new AlgorithmIdentifier
;
6814 algorithmIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6815 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6819 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
6820 SnaccExcep::throwMe(-182);
6823 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BITSTRING_TAG_CODE
))
6824 || (tag1
== MAKE_TAG_ID (UNIV
, CONS
, BITSTRING_TAG_CODE
)))
6826 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6827 signatureValue
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6831 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
6832 SnaccExcep::throwMe(-183);
6835 bytesDecoded
+= seqBytesDecoded
;
6836 if (elmtLen0
== INDEFINITE_LEN
)
6838 BDecEoc (b
, bytesDecoded
, env
);
6841 else if (seqBytesDecoded
!= elmtLen0
)
6843 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
6844 SnaccExcep::throwMe(-184);
6848 } // AttributeCertificate::BDecContent
6850 AsnLen
AttributeCertificate::BEnc (BUF_TYPE b
)
6853 l
= BEncContent (b
);
6854 l
+= BEncConsLen (b
, l
);
6855 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6859 void AttributeCertificate::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6864 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6866 Asn1Error
<< "AttributeCertificate::BDec: ERROR - wrong tag" << endl
;
6867 SnaccExcep::throwMe(-185);
6869 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6870 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6873 void AttributeCertificate::Print (ostream
&os
) const
6876 os
<< "{ -- SEQUENCE --" << endl
;
6877 indentG
+= stdIndentG
;
6879 if (NOT_NULL (attributeCertificateInfo
))
6881 Indent (os
, indentG
);
6882 os
<< "attributeCertificateInfo ";
6883 os
<< *attributeCertificateInfo
;
6887 Indent (os
, indentG
);
6888 os
<< "attributeCertificateInfo ";
6893 if (NOT_NULL (algorithmIdentifier
))
6895 Indent (os
, indentG
);
6896 os
<< "algorithmIdentifier ";
6897 os
<< *algorithmIdentifier
;
6901 Indent (os
, indentG
);
6902 os
<< "algorithmIdentifier ";
6908 Indent (os
, indentG
);
6909 os
<< "signatureValue ";
6910 os
<< signatureValue
;
6914 indentG
-= stdIndentG
;
6915 Indent (os
, indentG
);
6918 } // AttributeCertificate::Print
6921 AsnType
*CertificationPathSeqOf::Clone() const
6923 return new CertificationPathSeqOf
;
6926 AsnType
*CertificationPathSeqOf::Copy() const
6928 return new CertificationPathSeqOf (*this);
6931 AsnLen
CertificationPathSeqOf::BEnc (BUF_TYPE b
)
6934 l
= BEncContent (b
);
6935 l
+= BEncConsLen (b
, l
);
6936 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6940 void CertificationPathSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6945 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6947 Asn1Error
<< "CertificationPathSeqOf::BDec: ERROR - wrong tag" << endl
;
6948 SnaccExcep::throwMe(-186);
6950 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6951 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6954 CertificationPathSeqOf::CertificationPathSeqOf (const CertificationPathSeqOf
&)
6956 Asn1Error
<< "use of incompletely defined CertificationPathSeqOf::CertificationPathSeqOf (const CertificationPathSeqOf &)" << endl
;
6960 CertificationPathSeqOf::~CertificationPathSeqOf()
6963 for (; Curr() != NULL
; RemoveCurrFromList())
6965 } // end of destructor
6968 CertificationPathSeqOf
&CertificationPathSeqOf::operator = (const CertificationPathSeqOf
&that
)
6969 #else // SNACC_DEEP_COPY
6970 CertificationPathSeqOf
&CertificationPathSeqOf::operator = (const CertificationPathSeqOf
&)
6971 #endif // SNACC_DEEP_COPY
6977 for (; Curr(); RemoveCurrFromList())
6980 //that.SetCurrToFirst();
6981 //for (; that.Curr(); that.GoNext())
6982 // AppendCopy (*that.Curr());
6983 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
6984 AppendCopy (*run
->elmt
);
6988 #else // SNACC_DEEP_COPY
6989 Asn1Error
<< "use of incompletely defined CertificationPathSeqOf &CertificationPathSeqOf::operator = (const CertificationPathSeqOf &)" << endl
;
6991 // if your compiler complains here, check the -novolat option
6992 #endif // SNACC_DEEP_COPY
6995 void CertificationPathSeqOf::Print (ostream
&os
) const
6998 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
6999 indentG
+= stdIndentG
;
7001 //for (; Curr() != NULL; GoNext())
7002 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
7004 Indent (os
, indentG
);
7007 //if (Curr() != Last())
7012 indentG
-= stdIndentG
;
7013 Indent (os
, indentG
);
7021 void CertificationPathSeqOf::SetCurrElmt (unsigned long int index
)
7023 unsigned long int i
;
7026 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
7028 } // CertificationPathSeqOf::SetCurrElmt
7031 unsigned long int CertificationPathSeqOf::GetCurrElmtIndex()
7033 unsigned long int i
;
7037 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
7046 } // CertificationPathSeqOf::GetCurrElmtIndex
7049 // alloc new list elmt, put at end of list
7050 // and return the component type
7051 CertificatePair
*CertificationPathSeqOf::Append()
7053 AsnListElmt
*newElmt
;
7054 newElmt
= new AsnListElmt
;
7055 newElmt
->elmt
= new CertificatePair
;
7056 newElmt
->next
= NULL
;
7059 newElmt
->prev
= NULL
;
7060 first
= last
= newElmt
;
7064 newElmt
->prev
= last
;
7065 last
->next
= newElmt
;
7069 return (curr
= newElmt
)->elmt
;
7070 } // CertificationPathSeqOf::Append
7073 // alloc new list elmt, put at begining of list
7074 // and return the component type
7075 CertificatePair
*CertificationPathSeqOf::Prepend()
7077 AsnListElmt
*newElmt
;
7078 newElmt
= new AsnListElmt
;
7079 newElmt
->elmt
= new CertificatePair
;
7080 newElmt
->prev
= NULL
;
7083 newElmt
->next
= NULL
;
7084 first
= last
= newElmt
;
7088 newElmt
->next
= first
;
7089 first
->prev
= newElmt
;
7093 return (curr
= newElmt
)->elmt
;
7094 } // CertificationPathSeqOf::Prepend
7097 // alloc new list elmt, insert it before the
7098 // current element and return the component type
7099 // if the current element is null, the new element
7100 // is placed at the beginning of the list.
7101 CertificatePair
*CertificationPathSeqOf::InsertBefore()
7103 AsnListElmt
*newElmt
;
7104 newElmt
= new AsnListElmt
;
7105 newElmt
->elmt
= new CertificatePair
;
7108 newElmt
->next
= first
;
7109 newElmt
->prev
= NULL
;
7116 newElmt
->next
= curr
;
7117 newElmt
->prev
= curr
->prev
;
7118 curr
->prev
= newElmt
;
7122 newElmt
->prev
->next
= newElmt
;
7125 return (curr
= newElmt
)->elmt
;
7126 } // CertificationPathSeqOf::InsertBefore
7129 // alloc new list elmt, insert it after the
7130 // current element and return the component type
7131 // if the current element is null, the new element
7132 // is placed at the end of the list.
7133 CertificatePair
*CertificationPathSeqOf::InsertAfter()
7135 AsnListElmt
*newElmt
;
7136 newElmt
= new AsnListElmt
;
7137 newElmt
->elmt
= new CertificatePair
;
7140 newElmt
->prev
= last
;
7141 newElmt
->next
= NULL
;
7148 newElmt
->prev
= curr
;
7149 newElmt
->next
= curr
->next
;
7150 curr
->next
= newElmt
;
7154 newElmt
->next
->prev
= newElmt
;
7157 return (curr
= newElmt
)->elmt
;
7158 } // CertificationPathSeqOf::InsertAfter
7161 CertificationPathSeqOf
&CertificationPathSeqOf::AppendCopy (CertificatePair
&elmt
)
7163 AsnListElmt
*newElmt
;
7164 newElmt
= new AsnListElmt
;
7165 newElmt
->elmt
= new CertificatePair
;
7166 *newElmt
->elmt
= elmt
;
7167 newElmt
->next
= NULL
;
7170 newElmt
->prev
= NULL
;
7171 first
= last
= newElmt
;
7175 newElmt
->prev
= last
;
7176 last
->next
= newElmt
;
7184 CertificationPathSeqOf
&CertificationPathSeqOf::PrependCopy (CertificatePair
&elmt
)
7186 AsnListElmt
*newElmt
;
7187 newElmt
= new AsnListElmt
;
7188 newElmt
->elmt
= new CertificatePair
;
7189 *newElmt
->elmt
= elmt
;
7190 newElmt
->prev
= NULL
;
7193 newElmt
->next
= NULL
;
7194 first
= last
= newElmt
;
7198 newElmt
->next
= first
;
7199 first
->prev
= newElmt
;
7204 } // CertificationPathSeqOf::PrependCopy
7207 // alloc new list elmt, insert it before the
7208 // current element, copy the given elmt into the new elmt
7209 // and return the component type.
7210 // if the current element is null, the new element
7211 // is placed at the beginning of the list.
7212 CertificationPathSeqOf
&CertificationPathSeqOf::InsertBeforeAndCopy (CertificatePair
&elmt
)
7214 AsnListElmt
*newElmt
;
7216 newElmt
= new AsnListElmt
;
7217 newElmt
->elmt
= new CertificatePair
;
7218 *newElmt
->elmt
= elmt
;
7222 newElmt
->next
= first
;
7223 newElmt
->prev
= NULL
;
7230 newElmt
->next
= curr
;
7231 newElmt
->prev
= curr
->prev
;
7232 curr
->prev
= newElmt
;
7236 newElmt
->prev
->next
= newElmt
;
7240 } // CertificationPathSeqOf::InsertBeforeAndCopy
7243 // alloc new list elmt, insert it after the
7244 // current element, copy given elmt in to new elmt
7245 // and return the component type
7246 // if the current element is null, the new element
7247 // is placed at the end of the list.
7248 CertificationPathSeqOf
&CertificationPathSeqOf::InsertAfterAndCopy (CertificatePair
&elmt
)
7250 AsnListElmt
*newElmt
;
7252 newElmt
= new AsnListElmt
;
7253 newElmt
->elmt
= new CertificatePair
;
7254 *newElmt
->elmt
= elmt
;
7257 newElmt
->prev
= last
;
7258 newElmt
->next
= NULL
;
7265 newElmt
->prev
= curr
;
7266 newElmt
->next
= curr
->next
;
7267 curr
->next
= newElmt
;
7271 newElmt
->next
->prev
= newElmt
;
7275 } // CertificationPathSeqOf::InsertAfterAndCopy
7278 // remove current element from list if current element is not NULL
7279 // The new current element will be the next element.
7280 // If the current element is the last element in the list
7281 // the second but last element will become the new current element.
7282 void CertificationPathSeqOf::RemoveCurrFromList()
7284 AsnListElmt
*del_elmt
;
7292 first
= last
= curr
= NULL
;
7293 else if (curr
== first
)
7295 curr
= first
= first
->next
;
7298 else if (curr
== last
)
7300 curr
= last
= last
->prev
;
7305 curr
->prev
->next
= curr
->next
;
7306 curr
->next
->prev
= curr
->prev
;
7309 delete del_elmt
->elmt
;
7315 AsnLen
CertificationPathSeqOf::BEncContent (BUF_TYPE b
)
7317 AsnListElmt
*currElmt
;
7319 AsnLen totalLen
= 0;
7320 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
7323 elmtLen
= currElmt
->elmt
->BEncContent (b
);
7324 elmtLen
+= BEncConsLen (b
, elmtLen
);
7326 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
7327 totalLen
+= elmtLen
;
7330 } // CertificationPathSeqOf::BEncContent
7333 void CertificationPathSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
7334 AsnLen
&bytesDecoded
, ENV_TYPE env
)
7336 CertificatePair
*listElmt
;
7338 AsnLen listBytesDecoded
= 0;
7341 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
7343 tag1
= BDecTag (b
, listBytesDecoded
, env
);
7344 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
7346 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
7349 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
7351 Asn1Error
<< "Unexpected Tag" << endl
;
7352 SnaccExcep::throwMe(-187);
7355 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
7356 listElmt
= Append();
7357 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
7360 bytesDecoded
+= listBytesDecoded
;
7361 } // CertificationPathSeqOf::BDecContent
7364 AsnType
*ForwardCertificationPath::Clone() const
7366 return new ForwardCertificationPath
;
7369 AsnType
*ForwardCertificationPath::Copy() const
7371 return new ForwardCertificationPath (*this);
7374 AsnLen
ForwardCertificationPath::BEnc (BUF_TYPE b
)
7377 l
= BEncContent (b
);
7378 l
+= BEncConsLen (b
, l
);
7379 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
7383 void ForwardCertificationPath::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
7388 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
7390 Asn1Error
<< "ForwardCertificationPath::BDec: ERROR - wrong tag" << endl
;
7391 SnaccExcep::throwMe(-188);
7393 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
7394 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
7397 ForwardCertificationPath::ForwardCertificationPath (const ForwardCertificationPath
&)
7399 Asn1Error
<< "use of incompletely defined ForwardCertificationPath::ForwardCertificationPath (const ForwardCertificationPath &)" << endl
;
7403 ForwardCertificationPath::~ForwardCertificationPath()
7406 for (; Curr() != NULL
; RemoveCurrFromList())
7408 } // end of destructor
7411 ForwardCertificationPath
&ForwardCertificationPath::operator = (const ForwardCertificationPath
&that
)
7412 #else // SNACC_DEEP_COPY
7413 ForwardCertificationPath
&ForwardCertificationPath::operator = (const ForwardCertificationPath
&)
7414 #endif // SNACC_DEEP_COPY
7420 for (; Curr(); RemoveCurrFromList())
7423 //that.SetCurrToFirst();
7424 //for (; that.Curr(); that.GoNext())
7425 // AppendCopy (*that.Curr());
7426 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
7427 AppendCopy (*run
->elmt
);
7431 #else // SNACC_DEEP_COPY
7432 Asn1Error
<< "use of incompletely defined ForwardCertificationPath &ForwardCertificationPath::operator = (const ForwardCertificationPath &)" << endl
;
7434 // if your compiler complains here, check the -novolat option
7435 #endif // SNACC_DEEP_COPY
7438 void ForwardCertificationPath::Print (ostream
&os
) const
7441 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
7442 indentG
+= stdIndentG
;
7444 //for (; Curr() != NULL; GoNext())
7445 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
7447 Indent (os
, indentG
);
7450 //if (Curr() != Last())
7455 indentG
-= stdIndentG
;
7456 Indent (os
, indentG
);
7464 void ForwardCertificationPath::SetCurrElmt (unsigned long int index
)
7466 unsigned long int i
;
7469 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
7471 } // ForwardCertificationPath::SetCurrElmt
7474 unsigned long int ForwardCertificationPath::GetCurrElmtIndex()
7476 unsigned long int i
;
7480 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
7489 } // ForwardCertificationPath::GetCurrElmtIndex
7492 // alloc new list elmt, put at end of list
7493 // and return the component type
7494 CrossCertificates
*ForwardCertificationPath::Append()
7496 AsnListElmt
*newElmt
;
7497 newElmt
= new AsnListElmt
;
7498 newElmt
->elmt
= new CrossCertificates
;
7499 newElmt
->next
= NULL
;
7502 newElmt
->prev
= NULL
;
7503 first
= last
= newElmt
;
7507 newElmt
->prev
= last
;
7508 last
->next
= newElmt
;
7512 return (curr
= newElmt
)->elmt
;
7513 } // ForwardCertificationPath::Append
7516 // alloc new list elmt, put at begining of list
7517 // and return the component type
7518 CrossCertificates
*ForwardCertificationPath::Prepend()
7520 AsnListElmt
*newElmt
;
7521 newElmt
= new AsnListElmt
;
7522 newElmt
->elmt
= new CrossCertificates
;
7523 newElmt
->prev
= NULL
;
7526 newElmt
->next
= NULL
;
7527 first
= last
= newElmt
;
7531 newElmt
->next
= first
;
7532 first
->prev
= newElmt
;
7536 return (curr
= newElmt
)->elmt
;
7537 } // ForwardCertificationPath::Prepend
7540 // alloc new list elmt, insert it before the
7541 // current element and return the component type
7542 // if the current element is null, the new element
7543 // is placed at the beginning of the list.
7544 CrossCertificates
*ForwardCertificationPath::InsertBefore()
7546 AsnListElmt
*newElmt
;
7547 newElmt
= new AsnListElmt
;
7548 newElmt
->elmt
= new CrossCertificates
;
7551 newElmt
->next
= first
;
7552 newElmt
->prev
= NULL
;
7559 newElmt
->next
= curr
;
7560 newElmt
->prev
= curr
->prev
;
7561 curr
->prev
= newElmt
;
7565 newElmt
->prev
->next
= newElmt
;
7568 return (curr
= newElmt
)->elmt
;
7569 } // ForwardCertificationPath::InsertBefore
7572 // alloc new list elmt, insert it after the
7573 // current element and return the component type
7574 // if the current element is null, the new element
7575 // is placed at the end of the list.
7576 CrossCertificates
*ForwardCertificationPath::InsertAfter()
7578 AsnListElmt
*newElmt
;
7579 newElmt
= new AsnListElmt
;
7580 newElmt
->elmt
= new CrossCertificates
;
7583 newElmt
->prev
= last
;
7584 newElmt
->next
= NULL
;
7591 newElmt
->prev
= curr
;
7592 newElmt
->next
= curr
->next
;
7593 curr
->next
= newElmt
;
7597 newElmt
->next
->prev
= newElmt
;
7600 return (curr
= newElmt
)->elmt
;
7601 } // ForwardCertificationPath::InsertAfter
7604 ForwardCertificationPath
&ForwardCertificationPath::AppendCopy (CrossCertificates
&elmt
)
7606 AsnListElmt
*newElmt
;
7607 newElmt
= new AsnListElmt
;
7608 newElmt
->elmt
= new CrossCertificates
;
7609 *newElmt
->elmt
= elmt
;
7610 newElmt
->next
= NULL
;
7613 newElmt
->prev
= NULL
;
7614 first
= last
= newElmt
;
7618 newElmt
->prev
= last
;
7619 last
->next
= newElmt
;
7627 ForwardCertificationPath
&ForwardCertificationPath::PrependCopy (CrossCertificates
&elmt
)
7629 AsnListElmt
*newElmt
;
7630 newElmt
= new AsnListElmt
;
7631 newElmt
->elmt
= new CrossCertificates
;
7632 *newElmt
->elmt
= elmt
;
7633 newElmt
->prev
= NULL
;
7636 newElmt
->next
= NULL
;
7637 first
= last
= newElmt
;
7641 newElmt
->next
= first
;
7642 first
->prev
= newElmt
;
7647 } // ForwardCertificationPath::PrependCopy
7650 // alloc new list elmt, insert it before the
7651 // current element, copy the given elmt into the new elmt
7652 // and return the component type.
7653 // if the current element is null, the new element
7654 // is placed at the beginning of the list.
7655 ForwardCertificationPath
&ForwardCertificationPath::InsertBeforeAndCopy (CrossCertificates
&elmt
)
7657 AsnListElmt
*newElmt
;
7659 newElmt
= new AsnListElmt
;
7660 newElmt
->elmt
= new CrossCertificates
;
7661 *newElmt
->elmt
= elmt
;
7665 newElmt
->next
= first
;
7666 newElmt
->prev
= NULL
;
7673 newElmt
->next
= curr
;
7674 newElmt
->prev
= curr
->prev
;
7675 curr
->prev
= newElmt
;
7679 newElmt
->prev
->next
= newElmt
;
7683 } // ForwardCertificationPath::InsertBeforeAndCopy
7686 // alloc new list elmt, insert it after the
7687 // current element, copy given elmt in to new elmt
7688 // and return the component type
7689 // if the current element is null, the new element
7690 // is placed at the end of the list.
7691 ForwardCertificationPath
&ForwardCertificationPath::InsertAfterAndCopy (CrossCertificates
&elmt
)
7693 AsnListElmt
*newElmt
;
7695 newElmt
= new AsnListElmt
;
7696 newElmt
->elmt
= new CrossCertificates
;
7697 *newElmt
->elmt
= elmt
;
7700 newElmt
->prev
= last
;
7701 newElmt
->next
= NULL
;
7708 newElmt
->prev
= curr
;
7709 newElmt
->next
= curr
->next
;
7710 curr
->next
= newElmt
;
7714 newElmt
->next
->prev
= newElmt
;
7718 } // ForwardCertificationPath::InsertAfterAndCopy
7721 // remove current element from list if current element is not NULL
7722 // The new current element will be the next element.
7723 // If the current element is the last element in the list
7724 // the second but last element will become the new current element.
7725 void ForwardCertificationPath::RemoveCurrFromList()
7727 AsnListElmt
*del_elmt
;
7735 first
= last
= curr
= NULL
;
7736 else if (curr
== first
)
7738 curr
= first
= first
->next
;
7741 else if (curr
== last
)
7743 curr
= last
= last
->prev
;
7748 curr
->prev
->next
= curr
->next
;
7749 curr
->next
->prev
= curr
->prev
;
7752 delete del_elmt
->elmt
;
7758 AsnLen
ForwardCertificationPath::BEncContent (BUF_TYPE b
)
7760 AsnListElmt
*currElmt
;
7762 AsnLen totalLen
= 0;
7763 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
7766 elmtLen
= currElmt
->elmt
->BEncContent (b
);
7767 elmtLen
+= BEncConsLen (b
, elmtLen
);
7769 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
7770 totalLen
+= elmtLen
;
7773 } // ForwardCertificationPath::BEncContent
7776 void ForwardCertificationPath::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
7777 AsnLen
&bytesDecoded
, ENV_TYPE env
)
7779 CrossCertificates
*listElmt
;
7781 AsnLen listBytesDecoded
= 0;
7784 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
7786 tag1
= BDecTag (b
, listBytesDecoded
, env
);
7787 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
7789 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
7792 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
)))
7794 Asn1Error
<< "Unexpected Tag" << endl
;
7795 SnaccExcep::throwMe(-189);
7798 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
7799 listElmt
= Append();
7800 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
7803 bytesDecoded
+= listBytesDecoded
;
7804 } // ForwardCertificationPath::BDecContent
7807 ACPathData::ACPathData()
7810 attributeCertificate
= NULL
;
7813 ACPathData::ACPathData (const ACPathData
&)
7815 Asn1Error
<< "use of incompletely defined ACPathData::ACPathData (const ACPathData &)" << endl
;
7819 ACPathData::~ACPathData()
7822 delete attributeCertificate
;
7825 AsnType
*ACPathData::Clone() const
7827 return new ACPathData
;
7830 AsnType
*ACPathData::Copy() const
7832 return new ACPathData (*this);
7836 ACPathData
&ACPathData::operator = (const ACPathData
&that
)
7837 #else // SNACC_DEEP_COPY
7838 ACPathData
&ACPathData::operator = (const ACPathData
&)
7839 #endif // SNACC_DEEP_COPY
7844 if (that
.certificate
)
7847 certificate
= new Certificate
;
7848 *certificate
= *that
.certificate
;
7855 if (that
.attributeCertificate
)
7857 if (!attributeCertificate
)
7858 attributeCertificate
= new AttributeCertificate
;
7859 *attributeCertificate
= *that
.attributeCertificate
;
7863 delete attributeCertificate
;
7864 attributeCertificate
= NULL
;
7869 #else // SNACC_DEEP_COPY
7870 Asn1Error
<< "use of incompletely defined ACPathData &ACPathData::operator = (const ACPathData &)" << endl
;
7872 // if your compiler complains here, check the -novolat option
7873 #endif // SNACC_DEEP_COPY
7877 ACPathData::BEncContent (BUF_TYPE b
)
7879 AsnLen totalLen
= 0;
7882 if (NOT_NULL (attributeCertificate
))
7886 l
= attributeCertificate
->BEncContent (b
);
7887 l
+= BEncConsLen (b
, l
);
7889 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
7890 l
+= BEncConsLen (b
, l
);
7892 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
7896 if (NOT_NULL (certificate
))
7900 l
= certificate
->BEncContent (b
);
7901 l
+= BEncConsLen (b
, l
);
7903 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
7904 l
+= BEncConsLen (b
, l
);
7906 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
7911 } // ACPathData::BEncContent
7914 void ACPathData::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
7917 AsnLen seqBytesDecoded
= 0;
7924 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
7926 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
7928 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
7929 bytesDecoded
+= seqBytesDecoded
;
7934 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
7936 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
7937 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
7939 if (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
7941 Asn1Error
<< "Unexpected Tag" << endl
;
7942 SnaccExcep::throwMe(-190);
7945 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
7946 certificate
= new Certificate
;
7947 certificate
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
7948 if (elmtLen1
== INDEFINITE_LEN
)
7949 BDecEoc (b
, seqBytesDecoded
, env
);
7951 if (seqBytesDecoded
== elmtLen0
)
7953 bytesDecoded
+= seqBytesDecoded
;
7958 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
7960 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
7962 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
7963 bytesDecoded
+= seqBytesDecoded
;
7969 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
7971 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
7972 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
7974 if (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
7976 Asn1Error
<< "Unexpected Tag" << endl
;
7977 SnaccExcep::throwMe(-191);
7980 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
7981 attributeCertificate
= new AttributeCertificate
;
7982 attributeCertificate
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
7983 if (elmtLen1
== INDEFINITE_LEN
)
7984 BDecEoc (b
, seqBytesDecoded
, env
);
7988 bytesDecoded
+= seqBytesDecoded
;
7989 if (elmtLen0
== INDEFINITE_LEN
)
7991 BDecEoc (b
, bytesDecoded
, env
);
7994 else if (seqBytesDecoded
!= elmtLen0
)
7996 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
7997 SnaccExcep::throwMe(-192);
8001 } // ACPathData::BDecContent
8003 AsnLen
ACPathData::BEnc (BUF_TYPE b
)
8006 l
= BEncContent (b
);
8007 l
+= BEncConsLen (b
, l
);
8008 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8012 void ACPathData::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
8017 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
8019 Asn1Error
<< "ACPathData::BDec: ERROR - wrong tag" << endl
;
8020 SnaccExcep::throwMe(-193);
8022 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
8023 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
8026 void ACPathData::Print (ostream
&os
) const
8029 int nonePrinted
= true;
8030 os
<< "{ -- SEQUENCE --" << endl
;
8031 indentG
+= stdIndentG
;
8033 if (NOT_NULL (certificate
))
8035 nonePrinted
= false;
8036 Indent (os
, indentG
);
8037 os
<< "certificate ";
8042 Indent (os
, indentG
);
8043 os
<< "certificate ";
8048 if (NOT_NULL (attributeCertificate
))
8052 nonePrinted
= false;
8053 Indent (os
, indentG
);
8054 os
<< "attributeCertificate ";
8055 os
<< *attributeCertificate
;
8059 Indent (os
, indentG
);
8060 os
<< "attributeCertificate ";
8066 indentG
-= stdIndentG
;
8067 Indent (os
, indentG
);
8070 } // ACPathData::Print
8073 AsnType
*AttributeCertificationPathSeqOf::Clone() const
8075 return new AttributeCertificationPathSeqOf
;
8078 AsnType
*AttributeCertificationPathSeqOf::Copy() const
8080 return new AttributeCertificationPathSeqOf (*this);
8083 AsnLen
AttributeCertificationPathSeqOf::BEnc (BUF_TYPE b
)
8086 l
= BEncContent (b
);
8087 l
+= BEncConsLen (b
, l
);
8088 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8092 void AttributeCertificationPathSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
8097 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
8099 Asn1Error
<< "AttributeCertificationPathSeqOf::BDec: ERROR - wrong tag" << endl
;
8100 SnaccExcep::throwMe(-194);
8102 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
8103 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
8106 AttributeCertificationPathSeqOf::AttributeCertificationPathSeqOf (const AttributeCertificationPathSeqOf
&)
8108 Asn1Error
<< "use of incompletely defined AttributeCertificationPathSeqOf::AttributeCertificationPathSeqOf (const AttributeCertificationPathSeqOf &)" << endl
;
8112 AttributeCertificationPathSeqOf::~AttributeCertificationPathSeqOf()
8115 for (; Curr() != NULL
; RemoveCurrFromList())
8117 } // end of destructor
8120 AttributeCertificationPathSeqOf
&AttributeCertificationPathSeqOf::operator = (const AttributeCertificationPathSeqOf
&that
)
8121 #else // SNACC_DEEP_COPY
8122 AttributeCertificationPathSeqOf
&AttributeCertificationPathSeqOf::operator = (const AttributeCertificationPathSeqOf
&)
8123 #endif // SNACC_DEEP_COPY
8129 for (; Curr(); RemoveCurrFromList())
8132 //that.SetCurrToFirst();
8133 //for (; that.Curr(); that.GoNext())
8134 // AppendCopy (*that.Curr());
8135 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
8136 AppendCopy (*run
->elmt
);
8140 #else // SNACC_DEEP_COPY
8141 Asn1Error
<< "use of incompletely defined AttributeCertificationPathSeqOf &AttributeCertificationPathSeqOf::operator = (const AttributeCertificationPathSeqOf &)" << endl
;
8143 // if your compiler complains here, check the -novolat option
8144 #endif // SNACC_DEEP_COPY
8147 void AttributeCertificationPathSeqOf::Print (ostream
&os
) const
8150 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
8151 indentG
+= stdIndentG
;
8153 //for (; Curr() != NULL; GoNext())
8154 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
8156 Indent (os
, indentG
);
8159 //if (Curr() != Last())
8164 indentG
-= stdIndentG
;
8165 Indent (os
, indentG
);
8173 void AttributeCertificationPathSeqOf::SetCurrElmt (unsigned long int index
)
8175 unsigned long int i
;
8178 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
8180 } // AttributeCertificationPathSeqOf::SetCurrElmt
8183 unsigned long int AttributeCertificationPathSeqOf::GetCurrElmtIndex()
8185 unsigned long int i
;
8189 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
8198 } // AttributeCertificationPathSeqOf::GetCurrElmtIndex
8201 // alloc new list elmt, put at end of list
8202 // and return the component type
8203 ACPathData
*AttributeCertificationPathSeqOf::Append()
8205 AsnListElmt
*newElmt
;
8206 newElmt
= new AsnListElmt
;
8207 newElmt
->elmt
= new ACPathData
;
8208 newElmt
->next
= NULL
;
8211 newElmt
->prev
= NULL
;
8212 first
= last
= newElmt
;
8216 newElmt
->prev
= last
;
8217 last
->next
= newElmt
;
8221 return (curr
= newElmt
)->elmt
;
8222 } // AttributeCertificationPathSeqOf::Append
8225 // alloc new list elmt, put at begining of list
8226 // and return the component type
8227 ACPathData
*AttributeCertificationPathSeqOf::Prepend()
8229 AsnListElmt
*newElmt
;
8230 newElmt
= new AsnListElmt
;
8231 newElmt
->elmt
= new ACPathData
;
8232 newElmt
->prev
= NULL
;
8235 newElmt
->next
= NULL
;
8236 first
= last
= newElmt
;
8240 newElmt
->next
= first
;
8241 first
->prev
= newElmt
;
8245 return (curr
= newElmt
)->elmt
;
8246 } // AttributeCertificationPathSeqOf::Prepend
8249 // alloc new list elmt, insert it before the
8250 // current element and return the component type
8251 // if the current element is null, the new element
8252 // is placed at the beginning of the list.
8253 ACPathData
*AttributeCertificationPathSeqOf::InsertBefore()
8255 AsnListElmt
*newElmt
;
8256 newElmt
= new AsnListElmt
;
8257 newElmt
->elmt
= new ACPathData
;
8260 newElmt
->next
= first
;
8261 newElmt
->prev
= NULL
;
8268 newElmt
->next
= curr
;
8269 newElmt
->prev
= curr
->prev
;
8270 curr
->prev
= newElmt
;
8274 newElmt
->prev
->next
= newElmt
;
8277 return (curr
= newElmt
)->elmt
;
8278 } // AttributeCertificationPathSeqOf::InsertBefore
8281 // alloc new list elmt, insert it after the
8282 // current element and return the component type
8283 // if the current element is null, the new element
8284 // is placed at the end of the list.
8285 ACPathData
*AttributeCertificationPathSeqOf::InsertAfter()
8287 AsnListElmt
*newElmt
;
8288 newElmt
= new AsnListElmt
;
8289 newElmt
->elmt
= new ACPathData
;
8292 newElmt
->prev
= last
;
8293 newElmt
->next
= NULL
;
8300 newElmt
->prev
= curr
;
8301 newElmt
->next
= curr
->next
;
8302 curr
->next
= newElmt
;
8306 newElmt
->next
->prev
= newElmt
;
8309 return (curr
= newElmt
)->elmt
;
8310 } // AttributeCertificationPathSeqOf::InsertAfter
8313 AttributeCertificationPathSeqOf
&AttributeCertificationPathSeqOf::AppendCopy (ACPathData
&elmt
)
8315 AsnListElmt
*newElmt
;
8316 newElmt
= new AsnListElmt
;
8317 newElmt
->elmt
= new ACPathData
;
8318 *newElmt
->elmt
= elmt
;
8319 newElmt
->next
= NULL
;
8322 newElmt
->prev
= NULL
;
8323 first
= last
= newElmt
;
8327 newElmt
->prev
= last
;
8328 last
->next
= newElmt
;
8336 AttributeCertificationPathSeqOf
&AttributeCertificationPathSeqOf::PrependCopy (ACPathData
&elmt
)
8338 AsnListElmt
*newElmt
;
8339 newElmt
= new AsnListElmt
;
8340 newElmt
->elmt
= new ACPathData
;
8341 *newElmt
->elmt
= elmt
;
8342 newElmt
->prev
= NULL
;
8345 newElmt
->next
= NULL
;
8346 first
= last
= newElmt
;
8350 newElmt
->next
= first
;
8351 first
->prev
= newElmt
;
8356 } // AttributeCertificationPathSeqOf::PrependCopy
8359 // alloc new list elmt, insert it before the
8360 // current element, copy the given elmt into the new elmt
8361 // and return the component type.
8362 // if the current element is null, the new element
8363 // is placed at the beginning of the list.
8364 AttributeCertificationPathSeqOf
&AttributeCertificationPathSeqOf::InsertBeforeAndCopy (ACPathData
&elmt
)
8366 AsnListElmt
*newElmt
;
8368 newElmt
= new AsnListElmt
;
8369 newElmt
->elmt
= new ACPathData
;
8370 *newElmt
->elmt
= elmt
;
8374 newElmt
->next
= first
;
8375 newElmt
->prev
= NULL
;
8382 newElmt
->next
= curr
;
8383 newElmt
->prev
= curr
->prev
;
8384 curr
->prev
= newElmt
;
8388 newElmt
->prev
->next
= newElmt
;
8392 } // AttributeCertificationPathSeqOf::InsertBeforeAndCopy
8395 // alloc new list elmt, insert it after the
8396 // current element, copy given elmt in to new elmt
8397 // and return the component type
8398 // if the current element is null, the new element
8399 // is placed at the end of the list.
8400 AttributeCertificationPathSeqOf
&AttributeCertificationPathSeqOf::InsertAfterAndCopy (ACPathData
&elmt
)
8402 AsnListElmt
*newElmt
;
8404 newElmt
= new AsnListElmt
;
8405 newElmt
->elmt
= new ACPathData
;
8406 *newElmt
->elmt
= elmt
;
8409 newElmt
->prev
= last
;
8410 newElmt
->next
= NULL
;
8417 newElmt
->prev
= curr
;
8418 newElmt
->next
= curr
->next
;
8419 curr
->next
= newElmt
;
8423 newElmt
->next
->prev
= newElmt
;
8427 } // AttributeCertificationPathSeqOf::InsertAfterAndCopy
8430 // remove current element from list if current element is not NULL
8431 // The new current element will be the next element.
8432 // If the current element is the last element in the list
8433 // the second but last element will become the new current element.
8434 void AttributeCertificationPathSeqOf::RemoveCurrFromList()
8436 AsnListElmt
*del_elmt
;
8444 first
= last
= curr
= NULL
;
8445 else if (curr
== first
)
8447 curr
= first
= first
->next
;
8450 else if (curr
== last
)
8452 curr
= last
= last
->prev
;
8457 curr
->prev
->next
= curr
->next
;
8458 curr
->next
->prev
= curr
->prev
;
8461 delete del_elmt
->elmt
;
8467 AsnLen
AttributeCertificationPathSeqOf::BEncContent (BUF_TYPE b
)
8469 AsnListElmt
*currElmt
;
8471 AsnLen totalLen
= 0;
8472 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
8475 elmtLen
= currElmt
->elmt
->BEncContent (b
);
8476 elmtLen
+= BEncConsLen (b
, elmtLen
);
8478 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8479 totalLen
+= elmtLen
;
8482 } // AttributeCertificationPathSeqOf::BEncContent
8485 void AttributeCertificationPathSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
8486 AsnLen
&bytesDecoded
, ENV_TYPE env
)
8488 ACPathData
*listElmt
;
8490 AsnLen listBytesDecoded
= 0;
8493 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
8495 tag1
= BDecTag (b
, listBytesDecoded
, env
);
8496 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
8498 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
8501 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
8503 Asn1Error
<< "Unexpected Tag" << endl
;
8504 SnaccExcep::throwMe(-195);
8507 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
8508 listElmt
= Append();
8509 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
8512 bytesDecoded
+= listBytesDecoded
;
8513 } // AttributeCertificationPathSeqOf::BDecContent
8516 Certificates::Certificates()
8519 userCertificate
= new Certificate
;
8521 userCertificate
= NULL
; // incomplete initialization of mandatory element!
8523 certificationPath
= NULL
;
8526 Certificates::Certificates (const Certificates
&)
8528 Asn1Error
<< "use of incompletely defined Certificates::Certificates (const Certificates &)" << endl
;
8532 Certificates::~Certificates()
8534 delete userCertificate
;
8535 delete certificationPath
;
8538 AsnType
*Certificates::Clone() const
8540 return new Certificates
;
8543 AsnType
*Certificates::Copy() const
8545 return new Certificates (*this);
8549 Certificates
&Certificates::operator = (const Certificates
&that
)
8550 #else // SNACC_DEEP_COPY
8551 Certificates
&Certificates::operator = (const Certificates
&)
8552 #endif // SNACC_DEEP_COPY
8557 if (that
.userCertificate
)
8559 if (!userCertificate
)
8560 userCertificate
= new Certificate
;
8561 *userCertificate
= *that
.userCertificate
;
8565 delete userCertificate
;
8566 userCertificate
= NULL
;
8568 if (that
.certificationPath
)
8570 if (!certificationPath
)
8571 certificationPath
= new ForwardCertificationPath
;
8572 *certificationPath
= *that
.certificationPath
;
8576 delete certificationPath
;
8577 certificationPath
= NULL
;
8582 #else // SNACC_DEEP_COPY
8583 Asn1Error
<< "use of incompletely defined Certificates &Certificates::operator = (const Certificates &)" << endl
;
8585 // if your compiler complains here, check the -novolat option
8586 #endif // SNACC_DEEP_COPY
8590 Certificates::BEncContent (BUF_TYPE b
)
8592 AsnLen totalLen
= 0;
8595 if (NOT_NULL (certificationPath
))
8598 l
= certificationPath
->BEncContent (b
);
8599 l
+= BEncConsLen (b
, l
);
8601 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8606 l
= userCertificate
->BEncContent (b
);
8607 l
+= BEncConsLen (b
, l
);
8609 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8613 } // Certificates::BEncContent
8616 void Certificates::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
8619 AsnLen seqBytesDecoded
= 0;
8621 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
8623 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
8625 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
8626 userCertificate
= new Certificate
;
8627 userCertificate
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
8628 if (seqBytesDecoded
== elmtLen0
)
8630 bytesDecoded
+= seqBytesDecoded
;
8635 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
8637 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
8639 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
8640 bytesDecoded
+= seqBytesDecoded
;
8647 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
8648 SnaccExcep::throwMe(-196);
8651 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
8653 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
8654 certificationPath
= new ForwardCertificationPath
;
8655 certificationPath
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
8658 bytesDecoded
+= seqBytesDecoded
;
8659 if (elmtLen0
== INDEFINITE_LEN
)
8661 BDecEoc (b
, bytesDecoded
, env
);
8664 else if (seqBytesDecoded
!= elmtLen0
)
8666 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
8667 SnaccExcep::throwMe(-197);
8671 } // Certificates::BDecContent
8673 AsnLen
Certificates::BEnc (BUF_TYPE b
)
8676 l
= BEncContent (b
);
8677 l
+= BEncConsLen (b
, l
);
8678 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8682 void Certificates::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
8687 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
8689 Asn1Error
<< "Certificates::BDec: ERROR - wrong tag" << endl
;
8690 SnaccExcep::throwMe(-198);
8692 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
8693 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
8696 void Certificates::Print (ostream
&os
) const
8699 os
<< "{ -- SEQUENCE --" << endl
;
8700 indentG
+= stdIndentG
;
8702 if (NOT_NULL (userCertificate
))
8704 Indent (os
, indentG
);
8705 os
<< "userCertificate ";
8706 os
<< *userCertificate
;
8710 Indent (os
, indentG
);
8711 os
<< "userCertificate ";
8716 if (NOT_NULL (certificationPath
))
8719 Indent (os
, indentG
);
8720 os
<< "certificationPath ";
8721 os
<< *certificationPath
;
8725 Indent (os
, indentG
);
8726 os
<< "certificationPath ";
8732 indentG
-= stdIndentG
;
8733 Indent (os
, indentG
);
8736 } // Certificates::Print
8739 CertificationPath::CertificationPath()
8742 userCertificate
= new Certificate
;
8744 userCertificate
= NULL
; // incomplete initialization of mandatory element!
8746 theCACertificates
= NULL
;
8749 CertificationPath::CertificationPath (const CertificationPath
&)
8751 Asn1Error
<< "use of incompletely defined CertificationPath::CertificationPath (const CertificationPath &)" << endl
;
8755 CertificationPath::~CertificationPath()
8757 delete userCertificate
;
8758 delete theCACertificates
;
8761 AsnType
*CertificationPath::Clone() const
8763 return new CertificationPath
;
8766 AsnType
*CertificationPath::Copy() const
8768 return new CertificationPath (*this);
8772 CertificationPath
&CertificationPath::operator = (const CertificationPath
&that
)
8773 #else // SNACC_DEEP_COPY
8774 CertificationPath
&CertificationPath::operator = (const CertificationPath
&)
8775 #endif // SNACC_DEEP_COPY
8780 if (that
.userCertificate
)
8782 if (!userCertificate
)
8783 userCertificate
= new Certificate
;
8784 *userCertificate
= *that
.userCertificate
;
8788 delete userCertificate
;
8789 userCertificate
= NULL
;
8791 if (that
.theCACertificates
)
8793 if (!theCACertificates
)
8794 theCACertificates
= new CertificationPathSeqOf
;
8795 *theCACertificates
= *that
.theCACertificates
;
8799 delete theCACertificates
;
8800 theCACertificates
= NULL
;
8805 #else // SNACC_DEEP_COPY
8806 Asn1Error
<< "use of incompletely defined CertificationPath &CertificationPath::operator = (const CertificationPath &)" << endl
;
8808 // if your compiler complains here, check the -novolat option
8809 #endif // SNACC_DEEP_COPY
8813 CertificationPath::BEncContent (BUF_TYPE b
)
8815 AsnLen totalLen
= 0;
8818 if (NOT_NULL (theCACertificates
))
8821 l
= theCACertificates
->BEncContent (b
);
8822 l
+= BEncConsLen (b
, l
);
8824 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8829 l
= userCertificate
->BEncContent (b
);
8830 l
+= BEncConsLen (b
, l
);
8832 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8836 } // CertificationPath::BEncContent
8839 void CertificationPath::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
8842 AsnLen seqBytesDecoded
= 0;
8844 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
8846 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
8848 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
8849 userCertificate
= new Certificate
;
8850 userCertificate
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
8851 if (seqBytesDecoded
== elmtLen0
)
8853 bytesDecoded
+= seqBytesDecoded
;
8858 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
8860 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
8862 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
8863 bytesDecoded
+= seqBytesDecoded
;
8870 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
8871 SnaccExcep::throwMe(-199);
8874 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
8876 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
8877 theCACertificates
= new CertificationPathSeqOf
;
8878 theCACertificates
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
8881 bytesDecoded
+= seqBytesDecoded
;
8882 if (elmtLen0
== INDEFINITE_LEN
)
8884 BDecEoc (b
, bytesDecoded
, env
);
8887 else if (seqBytesDecoded
!= elmtLen0
)
8889 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
8890 SnaccExcep::throwMe(-200);
8894 } // CertificationPath::BDecContent
8896 AsnLen
CertificationPath::BEnc (BUF_TYPE b
)
8899 l
= BEncContent (b
);
8900 l
+= BEncConsLen (b
, l
);
8901 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
8905 void CertificationPath::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
8910 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
8912 Asn1Error
<< "CertificationPath::BDec: ERROR - wrong tag" << endl
;
8913 SnaccExcep::throwMe(-201);
8915 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
8916 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
8919 void CertificationPath::Print (ostream
&os
) const
8922 os
<< "{ -- SEQUENCE --" << endl
;
8923 indentG
+= stdIndentG
;
8925 if (NOT_NULL (userCertificate
))
8927 Indent (os
, indentG
);
8928 os
<< "userCertificate ";
8929 os
<< *userCertificate
;
8933 Indent (os
, indentG
);
8934 os
<< "userCertificate ";
8939 if (NOT_NULL (theCACertificates
))
8942 Indent (os
, indentG
);
8943 os
<< "theCACertificates ";
8944 os
<< *theCACertificates
;
8948 Indent (os
, indentG
);
8949 os
<< "theCACertificates ";
8955 indentG
-= stdIndentG
;
8956 Indent (os
, indentG
);
8959 } // CertificationPath::Print
8962 AttributeCertificationPath::AttributeCertificationPath()
8965 attributeCertificate
= new AttributeCertificate
;
8967 attributeCertificate
= NULL
; // incomplete initialization of mandatory element!
8972 AttributeCertificationPath::AttributeCertificationPath (const AttributeCertificationPath
&)
8974 Asn1Error
<< "use of incompletely defined AttributeCertificationPath::AttributeCertificationPath (const AttributeCertificationPath &)" << endl
;
8978 AttributeCertificationPath::~AttributeCertificationPath()
8980 delete attributeCertificate
;
8984 AsnType
*AttributeCertificationPath::Clone() const
8986 return new AttributeCertificationPath
;
8989 AsnType
*AttributeCertificationPath::Copy() const
8991 return new AttributeCertificationPath (*this);
8995 AttributeCertificationPath
&AttributeCertificationPath::operator = (const AttributeCertificationPath
&that
)
8996 #else // SNACC_DEEP_COPY
8997 AttributeCertificationPath
&AttributeCertificationPath::operator = (const AttributeCertificationPath
&)
8998 #endif // SNACC_DEEP_COPY
9003 if (that
.attributeCertificate
)
9005 if (!attributeCertificate
)
9006 attributeCertificate
= new AttributeCertificate
;
9007 *attributeCertificate
= *that
.attributeCertificate
;
9011 delete attributeCertificate
;
9012 attributeCertificate
= NULL
;
9017 acPath
= new AttributeCertificationPathSeqOf
;
9018 *acPath
= *that
.acPath
;
9028 #else // SNACC_DEEP_COPY
9029 Asn1Error
<< "use of incompletely defined AttributeCertificationPath &AttributeCertificationPath::operator = (const AttributeCertificationPath &)" << endl
;
9031 // if your compiler complains here, check the -novolat option
9032 #endif // SNACC_DEEP_COPY
9036 AttributeCertificationPath::BEncContent (BUF_TYPE b
)
9038 AsnLen totalLen
= 0;
9041 if (NOT_NULL (acPath
))
9044 l
= acPath
->BEncContent (b
);
9045 l
+= BEncConsLen (b
, l
);
9047 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
9052 l
= attributeCertificate
->BEncContent (b
);
9053 l
+= BEncConsLen (b
, l
);
9055 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
9059 } // AttributeCertificationPath::BEncContent
9062 void AttributeCertificationPath::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
9065 AsnLen seqBytesDecoded
= 0;
9067 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9069 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
9071 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
9072 attributeCertificate
= new AttributeCertificate
;
9073 attributeCertificate
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
9074 if (seqBytesDecoded
== elmtLen0
)
9076 bytesDecoded
+= seqBytesDecoded
;
9081 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9083 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
9085 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
9086 bytesDecoded
+= seqBytesDecoded
;
9093 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
9094 SnaccExcep::throwMe(-202);
9097 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
9099 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
9100 acPath
= new AttributeCertificationPathSeqOf
;
9101 acPath
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
9104 bytesDecoded
+= seqBytesDecoded
;
9105 if (elmtLen0
== INDEFINITE_LEN
)
9107 BDecEoc (b
, bytesDecoded
, env
);
9110 else if (seqBytesDecoded
!= elmtLen0
)
9112 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
9113 SnaccExcep::throwMe(-203);
9117 } // AttributeCertificationPath::BDecContent
9119 AsnLen
AttributeCertificationPath::BEnc (BUF_TYPE b
)
9122 l
= BEncContent (b
);
9123 l
+= BEncConsLen (b
, l
);
9124 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
9128 void AttributeCertificationPath::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
9133 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
9135 Asn1Error
<< "AttributeCertificationPath::BDec: ERROR - wrong tag" << endl
;
9136 SnaccExcep::throwMe(-204);
9138 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
9139 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
9142 void AttributeCertificationPath::Print (ostream
&os
) const
9145 os
<< "{ -- SEQUENCE --" << endl
;
9146 indentG
+= stdIndentG
;
9148 if (NOT_NULL (attributeCertificate
))
9150 Indent (os
, indentG
);
9151 os
<< "attributeCertificate ";
9152 os
<< *attributeCertificate
;
9156 Indent (os
, indentG
);
9157 os
<< "attributeCertificate ";
9162 if (NOT_NULL (acPath
))
9165 Indent (os
, indentG
);
9171 Indent (os
, indentG
);
9178 indentG
-= stdIndentG
;
9179 Indent (os
, indentG
);
9182 } // AttributeCertificationPath::Print
9185 AttributeCertificateAssertion::AttributeCertificateAssertion()
9189 attCertValidity
= NULL
;
9193 AttributeCertificateAssertion::AttributeCertificateAssertion (const AttributeCertificateAssertion
&)
9195 Asn1Error
<< "use of incompletely defined AttributeCertificateAssertion::AttributeCertificateAssertion (const AttributeCertificateAssertion &)" << endl
;
9199 AttributeCertificateAssertion::~AttributeCertificateAssertion()
9203 delete attCertValidity
;
9207 AsnType
*AttributeCertificateAssertion::Clone() const
9209 return new AttributeCertificateAssertion
;
9212 AsnType
*AttributeCertificateAssertion::Copy() const
9214 return new AttributeCertificateAssertion (*this);
9218 AttributeCertificateAssertion
&AttributeCertificateAssertion::operator = (const AttributeCertificateAssertion
&that
)
9219 #else // SNACC_DEEP_COPY
9220 AttributeCertificateAssertion
&AttributeCertificateAssertion::operator = (const AttributeCertificateAssertion
&)
9221 #endif // SNACC_DEEP_COPY
9229 subject
= new AttributeCertificateAssertionChoice
;
9230 *subject
= *that
.subject
;
9241 *issuer
= *that
.issuer
;
9248 if (that
.attCertValidity
)
9250 if (!attCertValidity
)
9251 attCertValidity
= new GeneralizedTime
;
9252 *attCertValidity
= *that
.attCertValidity
;
9256 delete attCertValidity
;
9257 attCertValidity
= NULL
;
9262 attType
= new AttributeCertificateAssertionSetOf
;
9263 *attType
= *that
.attType
;
9273 #else // SNACC_DEEP_COPY
9274 Asn1Error
<< "use of incompletely defined AttributeCertificateAssertion &AttributeCertificateAssertion::operator = (const AttributeCertificateAssertion &)" << endl
;
9276 // if your compiler complains here, check the -novolat option
9277 #endif // SNACC_DEEP_COPY
9281 AttributeCertificateAssertion::BEncContent (BUF_TYPE b
)
9283 AsnLen totalLen
= 0;
9286 if (NOT_NULL (attType
))
9290 l
= attType
->BEncContent (b
);
9291 l
+= BEncConsLen (b
, l
);
9293 l
+= BEncTag1 (b
, UNIV
, CONS
, SET_TAG_CODE
);
9294 l
+= BEncConsLen (b
, l
);
9296 l
+= BEncTag1 (b
, CNTX
, CONS
, 3);
9300 if (NOT_NULL (attCertValidity
))
9303 l
= attCertValidity
->BEncContent (b
);
9304 l
+= BEncDefLen (b
, l
);
9306 l
+= BEncTag1 (b
, UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
);
9307 l
+= BEncConsLen (b
, l
);
9309 l
+= BEncTag1 (b
, CNTX
, CONS
, 2);
9313 if (NOT_NULL (issuer
))
9316 l
= issuer
->BEncContent (b
);
9317 l
+= BEncConsLen (b
, l
);
9319 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
9323 if (NOT_NULL (subject
))
9326 l
= subject
->BEncContent (b
);
9327 l
+= BEncConsLen (b
, l
);
9329 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
9334 } // AttributeCertificateAssertion::BEncContent
9337 void AttributeCertificateAssertion::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
9340 AsnLen seqBytesDecoded
= 0;
9347 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9349 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
9351 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
9352 bytesDecoded
+= seqBytesDecoded
;
9357 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
9359 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
9360 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9361 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
9362 subject
= new AttributeCertificateAssertionChoice
;
9363 subject
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
9364 if (elmtLen1
== INDEFINITE_LEN
)
9365 BDecEoc (b
, seqBytesDecoded
, env
);
9367 if (seqBytesDecoded
== elmtLen0
)
9369 bytesDecoded
+= seqBytesDecoded
;
9374 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9376 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
9378 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
9379 bytesDecoded
+= seqBytesDecoded
;
9385 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
9387 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
9388 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9389 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
9391 issuer
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
9392 if (elmtLen1
== INDEFINITE_LEN
)
9393 BDecEoc (b
, seqBytesDecoded
, env
);
9395 if (seqBytesDecoded
== elmtLen0
)
9397 bytesDecoded
+= seqBytesDecoded
;
9402 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9404 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
9406 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
9407 bytesDecoded
+= seqBytesDecoded
;
9413 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2)))
9415 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
9416 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9418 if ((tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, GENERALIZEDTIME_TAG_CODE
))
9419 && (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, GENERALIZEDTIME_TAG_CODE
)))
9421 Asn1Error
<< "Unexpected Tag" << endl
;
9422 SnaccExcep::throwMe(-205);
9425 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
9426 attCertValidity
= new GeneralizedTime
;
9427 attCertValidity
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
9428 if (elmtLen1
== INDEFINITE_LEN
)
9429 BDecEoc (b
, seqBytesDecoded
, env
);
9431 if (seqBytesDecoded
== elmtLen0
)
9433 bytesDecoded
+= seqBytesDecoded
;
9438 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9440 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
9442 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
9443 bytesDecoded
+= seqBytesDecoded
;
9449 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 3)))
9451 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
9452 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
9454 if (tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SET_TAG_CODE
))
9456 Asn1Error
<< "Unexpected Tag" << endl
;
9457 SnaccExcep::throwMe(-206);
9460 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
9461 attType
= new AttributeCertificateAssertionSetOf
;
9462 attType
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
9463 if (elmtLen1
== INDEFINITE_LEN
)
9464 BDecEoc (b
, seqBytesDecoded
, env
);
9468 bytesDecoded
+= seqBytesDecoded
;
9469 if (elmtLen0
== INDEFINITE_LEN
)
9471 BDecEoc (b
, bytesDecoded
, env
);
9474 else if (seqBytesDecoded
!= elmtLen0
)
9476 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
9477 SnaccExcep::throwMe(-207);
9481 } // AttributeCertificateAssertion::BDecContent
9483 AsnLen
AttributeCertificateAssertion::BEnc (BUF_TYPE b
)
9486 l
= BEncContent (b
);
9487 l
+= BEncConsLen (b
, l
);
9488 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
9492 void AttributeCertificateAssertion::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
9497 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
9499 Asn1Error
<< "AttributeCertificateAssertion::BDec: ERROR - wrong tag" << endl
;
9500 SnaccExcep::throwMe(-208);
9502 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
9503 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
9506 void AttributeCertificateAssertion::Print (ostream
&os
) const
9509 int nonePrinted
= true;
9510 os
<< "{ -- SEQUENCE --" << endl
;
9511 indentG
+= stdIndentG
;
9513 if (NOT_NULL (subject
))
9515 nonePrinted
= false;
9516 Indent (os
, indentG
);
9522 Indent (os
, indentG
);
9528 if (NOT_NULL (issuer
))
9532 nonePrinted
= false;
9533 Indent (os
, indentG
);
9539 Indent (os
, indentG
);
9545 if (NOT_NULL (attCertValidity
))
9549 nonePrinted
= false;
9550 Indent (os
, indentG
);
9551 os
<< "attCertValidity ";
9552 os
<< *attCertValidity
;
9556 Indent (os
, indentG
);
9557 os
<< "attCertValidity ";
9562 if (NOT_NULL (attType
))
9566 nonePrinted
= false;
9567 Indent (os
, indentG
);
9573 Indent (os
, indentG
);
9580 indentG
-= stdIndentG
;
9581 Indent (os
, indentG
);
9584 } // AttributeCertificateAssertion::Print