1 // NOTE: this is a machine generated file--editing not recommended
3 // sm_x509ce.cpp - class member functions for ASN.1 module CertificateExtensions
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 PolicyQualifierInfo::PolicyQualifierInfo()
41 PolicyQualifierInfo::PolicyQualifierInfo (const PolicyQualifierInfo
&)
43 Asn1Error
<< "use of incompletely defined PolicyQualifierInfo::PolicyQualifierInfo (const PolicyQualifierInfo &)" << endl
;
47 PolicyQualifierInfo::~PolicyQualifierInfo()
52 AsnType
*PolicyQualifierInfo::Clone() const
54 return new PolicyQualifierInfo
;
57 AsnType
*PolicyQualifierInfo::Copy() const
59 return new PolicyQualifierInfo (*this);
63 PolicyQualifierInfo
&PolicyQualifierInfo::operator = (const PolicyQualifierInfo
&that
)
64 #else // SNACC_DEEP_COPY
65 PolicyQualifierInfo
&PolicyQualifierInfo::operator = (const PolicyQualifierInfo
&)
66 #endif // SNACC_DEEP_COPY
71 policyQualifierId
= that
.policyQualifierId
;
75 qualifier
= new AsnAny
;
76 *qualifier
= *that
.qualifier
;
86 #else // SNACC_DEEP_COPY
87 Asn1Error
<< "use of incompletely defined PolicyQualifierInfo &PolicyQualifierInfo::operator = (const PolicyQualifierInfo &)" << endl
;
89 // if your compiler complains here, check the -novolat option
90 #endif // SNACC_DEEP_COPY
94 PolicyQualifierInfo::BEncContent (BUF_TYPE b
)
99 if (NOT_NULL (qualifier
))
101 ENC_LOAD_ANYBUF(qualifier
, b
, l
);
105 l
= policyQualifierId
.BEncContent (b
);
106 l
+= BEncDefLen (b
, l
);
108 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
112 } // PolicyQualifierInfo::BEncContent
115 void PolicyQualifierInfo::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
118 AsnLen seqBytesDecoded
= 0;
120 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
122 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
124 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
125 policyQualifierId
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
126 if (seqBytesDecoded
== elmtLen0
)
128 bytesDecoded
+= seqBytesDecoded
;
135 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
137 BDecEoc (b
, seqBytesDecoded
, env
);
139 bytesDecoded
+= seqBytesDecoded
;
146 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
147 SnaccExcep::throwMe(-100);
151 qualifier
= new AsnAny
;
152 DEC_LOAD_ANYBUF(qualifier
, b
, seqBytesDecoded
, env
);
155 bytesDecoded
+= seqBytesDecoded
;
156 if (elmtLen0
== INDEFINITE_LEN
)
158 BDecEoc (b
, bytesDecoded
, env
);
161 else if (seqBytesDecoded
!= elmtLen0
)
163 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
164 SnaccExcep::throwMe(-101);
168 } // PolicyQualifierInfo::BDecContent
170 AsnLen
PolicyQualifierInfo::BEnc (BUF_TYPE b
)
174 l
+= BEncConsLen (b
, l
);
175 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
179 void PolicyQualifierInfo::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
184 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
186 Asn1Error
<< "PolicyQualifierInfo::BDec: ERROR - wrong tag" << endl
;
187 SnaccExcep::throwMe(-102);
189 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
190 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
193 void PolicyQualifierInfo::Print (ostream
&os
) const
196 os
<< "{ -- SEQUENCE --" << endl
;
197 indentG
+= stdIndentG
;
200 Indent (os
, indentG
);
201 os
<< "policyQualifierId ";
202 os
<< policyQualifierId
;
206 if (NOT_NULL (qualifier
))
209 Indent (os
, indentG
);
215 Indent (os
, indentG
);
222 indentG
-= stdIndentG
;
223 Indent (os
, indentG
);
226 } // PolicyQualifierInfo::Print
229 AsnType
*AttributesSyntax::Clone() const
231 return new AttributesSyntax
;
234 AsnType
*AttributesSyntax::Copy() const
236 return new AttributesSyntax (*this);
239 AsnLen
AttributesSyntax::BEnc (BUF_TYPE b
)
243 l
+= BEncConsLen (b
, l
);
244 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
248 void AttributesSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
253 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
255 Asn1Error
<< "AttributesSyntax::BDec: ERROR - wrong tag" << endl
;
256 SnaccExcep::throwMe(-103);
258 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
259 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
262 AttributesSyntax::AttributesSyntax (const AttributesSyntax
&)
264 Asn1Error
<< "use of incompletely defined AttributesSyntax::AttributesSyntax (const AttributesSyntax &)" << endl
;
268 AttributesSyntax::~AttributesSyntax()
271 for (; Curr() != NULL
; RemoveCurrFromList())
273 } // end of destructor
276 AttributesSyntax
&AttributesSyntax::operator = (const AttributesSyntax
&that
)
277 #else // SNACC_DEEP_COPY
278 AttributesSyntax
&AttributesSyntax::operator = (const AttributesSyntax
&)
279 #endif // SNACC_DEEP_COPY
285 for (; Curr(); RemoveCurrFromList())
288 //that.SetCurrToFirst();
289 //for (; that.Curr(); that.GoNext())
290 // AppendCopy (*that.Curr());
291 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
292 AppendCopy (*run
->elmt
);
296 #else // SNACC_DEEP_COPY
297 Asn1Error
<< "use of incompletely defined AttributesSyntax &AttributesSyntax::operator = (const AttributesSyntax &)" << endl
;
299 // if your compiler complains here, check the -novolat option
300 #endif // SNACC_DEEP_COPY
303 void AttributesSyntax::Print (ostream
&os
) const
306 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
307 indentG
+= stdIndentG
;
309 //for (; Curr() != NULL; GoNext())
310 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
312 Indent (os
, indentG
);
315 //if (Curr() != Last())
320 indentG
-= stdIndentG
;
321 Indent (os
, indentG
);
329 void AttributesSyntax::SetCurrElmt (unsigned long int index
)
334 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
336 } // AttributesSyntax::SetCurrElmt
339 unsigned long int AttributesSyntax::GetCurrElmtIndex()
345 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
354 } // AttributesSyntax::GetCurrElmtIndex
357 // alloc new list elmt, put at end of list
358 // and return the component type
359 Attribute
*AttributesSyntax::Append()
361 AsnListElmt
*newElmt
;
362 newElmt
= new AsnListElmt
;
363 newElmt
->elmt
= new Attribute
;
364 newElmt
->next
= NULL
;
367 newElmt
->prev
= NULL
;
368 first
= last
= newElmt
;
372 newElmt
->prev
= last
;
373 last
->next
= newElmt
;
377 return (curr
= newElmt
)->elmt
;
378 } // AttributesSyntax::Append
381 // alloc new list elmt, put at begining of list
382 // and return the component type
383 Attribute
*AttributesSyntax::Prepend()
385 AsnListElmt
*newElmt
;
386 newElmt
= new AsnListElmt
;
387 newElmt
->elmt
= new Attribute
;
388 newElmt
->prev
= NULL
;
391 newElmt
->next
= NULL
;
392 first
= last
= newElmt
;
396 newElmt
->next
= first
;
397 first
->prev
= newElmt
;
401 return (curr
= newElmt
)->elmt
;
402 } // AttributesSyntax::Prepend
405 // alloc new list elmt, insert it before the
406 // current element and return the component type
407 // if the current element is null, the new element
408 // is placed at the beginning of the list.
409 Attribute
*AttributesSyntax::InsertBefore()
411 AsnListElmt
*newElmt
;
412 newElmt
= new AsnListElmt
;
413 newElmt
->elmt
= new Attribute
;
416 newElmt
->next
= first
;
417 newElmt
->prev
= NULL
;
424 newElmt
->next
= curr
;
425 newElmt
->prev
= curr
->prev
;
426 curr
->prev
= newElmt
;
430 newElmt
->prev
->next
= newElmt
;
433 return (curr
= newElmt
)->elmt
;
434 } // AttributesSyntax::InsertBefore
437 // alloc new list elmt, insert it after the
438 // current element and return the component type
439 // if the current element is null, the new element
440 // is placed at the end of the list.
441 Attribute
*AttributesSyntax::InsertAfter()
443 AsnListElmt
*newElmt
;
444 newElmt
= new AsnListElmt
;
445 newElmt
->elmt
= new Attribute
;
448 newElmt
->prev
= last
;
449 newElmt
->next
= NULL
;
456 newElmt
->prev
= curr
;
457 newElmt
->next
= curr
->next
;
458 curr
->next
= newElmt
;
462 newElmt
->next
->prev
= newElmt
;
465 return (curr
= newElmt
)->elmt
;
466 } // AttributesSyntax::InsertAfter
469 AttributesSyntax
&AttributesSyntax::AppendCopy (Attribute
&elmt
)
471 AsnListElmt
*newElmt
;
472 newElmt
= new AsnListElmt
;
473 newElmt
->elmt
= new Attribute
;
474 *newElmt
->elmt
= elmt
;
475 newElmt
->next
= NULL
;
478 newElmt
->prev
= NULL
;
479 first
= last
= newElmt
;
483 newElmt
->prev
= last
;
484 last
->next
= newElmt
;
492 AttributesSyntax
&AttributesSyntax::PrependCopy (Attribute
&elmt
)
494 AsnListElmt
*newElmt
;
495 newElmt
= new AsnListElmt
;
496 newElmt
->elmt
= new Attribute
;
497 *newElmt
->elmt
= elmt
;
498 newElmt
->prev
= NULL
;
501 newElmt
->next
= NULL
;
502 first
= last
= newElmt
;
506 newElmt
->next
= first
;
507 first
->prev
= newElmt
;
512 } // AttributesSyntax::PrependCopy
515 // alloc new list elmt, insert it before the
516 // current element, copy the given elmt into the new elmt
517 // and return the component type.
518 // if the current element is null, the new element
519 // is placed at the beginning of the list.
520 AttributesSyntax
&AttributesSyntax::InsertBeforeAndCopy (Attribute
&elmt
)
522 AsnListElmt
*newElmt
;
524 newElmt
= new AsnListElmt
;
525 newElmt
->elmt
= new Attribute
;
526 *newElmt
->elmt
= elmt
;
530 newElmt
->next
= first
;
531 newElmt
->prev
= NULL
;
538 newElmt
->next
= curr
;
539 newElmt
->prev
= curr
->prev
;
540 curr
->prev
= newElmt
;
544 newElmt
->prev
->next
= newElmt
;
548 } // AttributesSyntax::InsertBeforeAndCopy
551 // alloc new list elmt, insert it after the
552 // current element, copy given elmt in to new elmt
553 // and return the component type
554 // if the current element is null, the new element
555 // is placed at the end of the list.
556 AttributesSyntax
&AttributesSyntax::InsertAfterAndCopy (Attribute
&elmt
)
558 AsnListElmt
*newElmt
;
560 newElmt
= new AsnListElmt
;
561 newElmt
->elmt
= new Attribute
;
562 *newElmt
->elmt
= elmt
;
565 newElmt
->prev
= last
;
566 newElmt
->next
= NULL
;
573 newElmt
->prev
= curr
;
574 newElmt
->next
= curr
->next
;
575 curr
->next
= newElmt
;
579 newElmt
->next
->prev
= newElmt
;
583 } // AttributesSyntax::InsertAfterAndCopy
586 // remove current element from list if current element is not NULL
587 // The new current element will be the next element.
588 // If the current element is the last element in the list
589 // the second but last element will become the new current element.
590 void AttributesSyntax::RemoveCurrFromList()
592 AsnListElmt
*del_elmt
;
600 first
= last
= curr
= NULL
;
601 else if (curr
== first
)
603 curr
= first
= first
->next
;
606 else if (curr
== last
)
608 curr
= last
= last
->prev
;
613 curr
->prev
->next
= curr
->next
;
614 curr
->next
->prev
= curr
->prev
;
617 delete del_elmt
->elmt
;
623 AsnLen
AttributesSyntax::BEncContent (BUF_TYPE b
)
625 AsnListElmt
*currElmt
;
628 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
631 elmtLen
= currElmt
->elmt
->BEncContent (b
);
632 elmtLen
+= BEncConsLen (b
, elmtLen
);
634 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
638 } // AttributesSyntax::BEncContent
641 void AttributesSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
642 AsnLen
&bytesDecoded
, ENV_TYPE env
)
646 AsnLen listBytesDecoded
= 0;
649 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
651 tag1
= BDecTag (b
, listBytesDecoded
, env
);
652 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
654 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
657 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
659 Asn1Error
<< "Unexpected Tag" << endl
;
660 SnaccExcep::throwMe(-104);
663 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
665 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
668 bytesDecoded
+= listBytesDecoded
;
669 } // AttributesSyntax::BDecContent
672 DistributionPointName::DistributionPointName()
674 choiceId
= fullNameCid
;
676 fullName
= new GeneralNames
;
678 fullName
= NULL
; // incomplete initialization of mandatory element!
682 DistributionPointName::DistributionPointName (const DistributionPointName
&)
684 Asn1Error
<< "use of incompletely defined DistributionPointName::DistributionPointName (const DistributionPointName &)" << endl
;
688 DistributionPointName::~DistributionPointName()
695 case nameRelativeToCRLIssuerCid
:
696 delete nameRelativeToCRLIssuer
;
699 } // end of destructor
701 AsnType
*DistributionPointName::Clone() const
703 return new DistributionPointName
;
706 AsnType
*DistributionPointName::Copy() const
708 return new DistributionPointName (*this);
712 DistributionPointName
&DistributionPointName::operator = (const DistributionPointName
&that
)
713 #else // SNACC_DEEP_COPY
714 DistributionPointName
&DistributionPointName::operator = (const DistributionPointName
&)
715 #endif // SNACC_DEEP_COPY
725 case nameRelativeToCRLIssuerCid
:
726 delete nameRelativeToCRLIssuer
;
729 switch (choiceId
= that
.choiceId
)
732 fullName
= new GeneralNames
;
733 *fullName
= *that
.fullName
;
735 case nameRelativeToCRLIssuerCid
:
736 nameRelativeToCRLIssuer
= new RelativeDistinguishedName
;
737 *nameRelativeToCRLIssuer
= *that
.nameRelativeToCRLIssuer
;
743 #else // SNACC_DEEP_COPY
744 Asn1Error
<< "use of incompletely defined DistributionPointName &DistributionPointName::operator = (const DistributionPointName &)" << endl
;
746 // if your compiler complains here, check the -novolat option
747 #endif // SNACC_DEEP_COPY
751 DistributionPointName::BEncContent (BUF_TYPE b
)
758 l
= fullName
->BEncContent (b
);
759 l
+= BEncConsLen (b
, l
);
761 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
764 case nameRelativeToCRLIssuerCid
:
766 l
= nameRelativeToCRLIssuer
->BEncContent (b
);
767 l
+= BEncConsLen (b
, l
);
769 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
774 } // DistributionPointName::BEncContent
777 void DistributionPointName::BDecContent (BUF_TYPE b
, AsnTag tag
, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
781 case MAKE_TAG_ID (CNTX
, CONS
, 0):
782 choiceId
= fullNameCid
;
783 fullName
= new GeneralNames
;
784 fullName
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
787 case MAKE_TAG_ID (CNTX
, CONS
, 1):
788 choiceId
= nameRelativeToCRLIssuerCid
;
789 nameRelativeToCRLIssuer
= new RelativeDistinguishedName
;
790 nameRelativeToCRLIssuer
->BDecContent (b
, tag
, elmtLen0
, bytesDecoded
, env
);
794 Asn1Error
<< "ERROR - unexpected tag in CHOICE" << endl
;
795 SnaccExcep::throwMe(-105);
798 } // DistributionPointName::BDecContent
801 AsnLen
DistributionPointName::BEnc (BUF_TYPE b
)
808 void DistributionPointName::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
813 /* CHOICEs are a special case - grab identifying tag */
814 /* this allows easier handling of nested CHOICEs */
815 tag
= BDecTag (b
, bytesDecoded
, env
);
816 elmtLen
= BDecLen (b
, bytesDecoded
, env
);
817 BDecContent (b
, tag
, elmtLen
, bytesDecoded
, env
);
820 void DistributionPointName::Print (ostream
&os
) const
830 os
<< "-- void3 --\n";
833 case nameRelativeToCRLIssuerCid
:
834 os
<< "nameRelativeToCRLIssuer ";
835 if (nameRelativeToCRLIssuer
)
836 os
<< *nameRelativeToCRLIssuer
;
838 os
<< "-- void3 --\n";
843 } // DistributionPointName::Print
845 PolicyMappingsSyntaxSeq::PolicyMappingsSyntaxSeq()
849 PolicyMappingsSyntaxSeq::PolicyMappingsSyntaxSeq (const PolicyMappingsSyntaxSeq
&)
851 Asn1Error
<< "use of incompletely defined PolicyMappingsSyntaxSeq::PolicyMappingsSyntaxSeq (const PolicyMappingsSyntaxSeq &)" << endl
;
855 PolicyMappingsSyntaxSeq::~PolicyMappingsSyntaxSeq()
859 AsnType
*PolicyMappingsSyntaxSeq::Clone() const
861 return new PolicyMappingsSyntaxSeq
;
864 AsnType
*PolicyMappingsSyntaxSeq::Copy() const
866 return new PolicyMappingsSyntaxSeq (*this);
870 PolicyMappingsSyntaxSeq
&PolicyMappingsSyntaxSeq::operator = (const PolicyMappingsSyntaxSeq
&that
)
871 #else // SNACC_DEEP_COPY
872 PolicyMappingsSyntaxSeq
&PolicyMappingsSyntaxSeq::operator = (const PolicyMappingsSyntaxSeq
&)
873 #endif // SNACC_DEEP_COPY
878 issuerDomainPolicy
= that
.issuerDomainPolicy
;
879 subjectDomainPolicy
= that
.subjectDomainPolicy
;
883 #else // SNACC_DEEP_COPY
884 Asn1Error
<< "use of incompletely defined PolicyMappingsSyntaxSeq &PolicyMappingsSyntaxSeq::operator = (const PolicyMappingsSyntaxSeq &)" << endl
;
886 // if your compiler complains here, check the -novolat option
887 #endif // SNACC_DEEP_COPY
891 PolicyMappingsSyntaxSeq::BEncContent (BUF_TYPE b
)
896 l
= subjectDomainPolicy
.BEncContent (b
);
897 l
+= BEncDefLen (b
, l
);
899 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
902 l
= issuerDomainPolicy
.BEncContent (b
);
903 l
+= BEncDefLen (b
, l
);
905 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
909 } // PolicyMappingsSyntaxSeq::BEncContent
912 void PolicyMappingsSyntaxSeq::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
915 AsnLen seqBytesDecoded
= 0;
917 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
919 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
921 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
922 issuerDomainPolicy
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
923 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
927 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
928 SnaccExcep::throwMe(-106);
931 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
933 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
934 subjectDomainPolicy
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
938 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
939 SnaccExcep::throwMe(-107);
942 bytesDecoded
+= seqBytesDecoded
;
943 if (elmtLen0
== INDEFINITE_LEN
)
945 BDecEoc (b
, bytesDecoded
, env
);
948 else if (seqBytesDecoded
!= elmtLen0
)
950 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
951 SnaccExcep::throwMe(-108);
955 } // PolicyMappingsSyntaxSeq::BDecContent
957 AsnLen
PolicyMappingsSyntaxSeq::BEnc (BUF_TYPE b
)
961 l
+= BEncConsLen (b
, l
);
962 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
966 void PolicyMappingsSyntaxSeq::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
971 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
973 Asn1Error
<< "PolicyMappingsSyntaxSeq::BDec: ERROR - wrong tag" << endl
;
974 SnaccExcep::throwMe(-109);
976 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
977 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
980 void PolicyMappingsSyntaxSeq::Print (ostream
&os
) const
983 os
<< "{ -- SEQUENCE --" << endl
;
984 indentG
+= stdIndentG
;
987 Indent (os
, indentG
);
988 os
<< "issuerDomainPolicy ";
989 os
<< issuerDomainPolicy
;
994 Indent (os
, indentG
);
995 os
<< "subjectDomainPolicy ";
996 os
<< subjectDomainPolicy
;
1000 indentG
-= stdIndentG
;
1001 Indent (os
, indentG
);
1004 } // PolicyMappingsSyntaxSeq::Print
1007 AsnType
*PolicyInformationSeqOf::Clone() const
1009 return new PolicyInformationSeqOf
;
1012 AsnType
*PolicyInformationSeqOf::Copy() const
1014 return new PolicyInformationSeqOf (*this);
1017 AsnLen
PolicyInformationSeqOf::BEnc (BUF_TYPE b
)
1020 l
= BEncContent (b
);
1021 l
+= BEncConsLen (b
, l
);
1022 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1026 void PolicyInformationSeqOf::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1031 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1033 Asn1Error
<< "PolicyInformationSeqOf::BDec: ERROR - wrong tag" << endl
;
1034 SnaccExcep::throwMe(-110);
1036 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1037 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1040 PolicyInformationSeqOf::PolicyInformationSeqOf (const PolicyInformationSeqOf
&)
1042 Asn1Error
<< "use of incompletely defined PolicyInformationSeqOf::PolicyInformationSeqOf (const PolicyInformationSeqOf &)" << endl
;
1046 PolicyInformationSeqOf::~PolicyInformationSeqOf()
1049 for (; Curr() != NULL
; RemoveCurrFromList())
1051 } // end of destructor
1054 PolicyInformationSeqOf
&PolicyInformationSeqOf::operator = (const PolicyInformationSeqOf
&that
)
1055 #else // SNACC_DEEP_COPY
1056 PolicyInformationSeqOf
&PolicyInformationSeqOf::operator = (const PolicyInformationSeqOf
&)
1057 #endif // SNACC_DEEP_COPY
1063 for (; Curr(); RemoveCurrFromList())
1066 //that.SetCurrToFirst();
1067 //for (; that.Curr(); that.GoNext())
1068 // AppendCopy (*that.Curr());
1069 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
1070 AppendCopy (*run
->elmt
);
1074 #else // SNACC_DEEP_COPY
1075 Asn1Error
<< "use of incompletely defined PolicyInformationSeqOf &PolicyInformationSeqOf::operator = (const PolicyInformationSeqOf &)" << endl
;
1077 // if your compiler complains here, check the -novolat option
1078 #endif // SNACC_DEEP_COPY
1081 void PolicyInformationSeqOf::Print (ostream
&os
) const
1084 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
1085 indentG
+= stdIndentG
;
1087 //for (; Curr() != NULL; GoNext())
1088 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
1090 Indent (os
, indentG
);
1093 //if (Curr() != Last())
1098 indentG
-= stdIndentG
;
1099 Indent (os
, indentG
);
1107 void PolicyInformationSeqOf::SetCurrElmt (unsigned long int index
)
1109 unsigned long int i
;
1112 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
1114 } // PolicyInformationSeqOf::SetCurrElmt
1117 unsigned long int PolicyInformationSeqOf::GetCurrElmtIndex()
1119 unsigned long int i
;
1123 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
1132 } // PolicyInformationSeqOf::GetCurrElmtIndex
1135 // alloc new list elmt, put at end of list
1136 // and return the component type
1137 PolicyQualifierInfo
*PolicyInformationSeqOf::Append()
1139 AsnListElmt
*newElmt
;
1140 newElmt
= new AsnListElmt
;
1141 newElmt
->elmt
= new PolicyQualifierInfo
;
1142 newElmt
->next
= NULL
;
1145 newElmt
->prev
= NULL
;
1146 first
= last
= newElmt
;
1150 newElmt
->prev
= last
;
1151 last
->next
= newElmt
;
1155 return (curr
= newElmt
)->elmt
;
1156 } // PolicyInformationSeqOf::Append
1159 // alloc new list elmt, put at begining of list
1160 // and return the component type
1161 PolicyQualifierInfo
*PolicyInformationSeqOf::Prepend()
1163 AsnListElmt
*newElmt
;
1164 newElmt
= new AsnListElmt
;
1165 newElmt
->elmt
= new PolicyQualifierInfo
;
1166 newElmt
->prev
= NULL
;
1169 newElmt
->next
= NULL
;
1170 first
= last
= newElmt
;
1174 newElmt
->next
= first
;
1175 first
->prev
= newElmt
;
1179 return (curr
= newElmt
)->elmt
;
1180 } // PolicyInformationSeqOf::Prepend
1183 // alloc new list elmt, insert it before the
1184 // current element and return the component type
1185 // if the current element is null, the new element
1186 // is placed at the beginning of the list.
1187 PolicyQualifierInfo
*PolicyInformationSeqOf::InsertBefore()
1189 AsnListElmt
*newElmt
;
1190 newElmt
= new AsnListElmt
;
1191 newElmt
->elmt
= new PolicyQualifierInfo
;
1194 newElmt
->next
= first
;
1195 newElmt
->prev
= NULL
;
1202 newElmt
->next
= curr
;
1203 newElmt
->prev
= curr
->prev
;
1204 curr
->prev
= newElmt
;
1208 newElmt
->prev
->next
= newElmt
;
1211 return (curr
= newElmt
)->elmt
;
1212 } // PolicyInformationSeqOf::InsertBefore
1215 // alloc new list elmt, insert it after the
1216 // current element and return the component type
1217 // if the current element is null, the new element
1218 // is placed at the end of the list.
1219 PolicyQualifierInfo
*PolicyInformationSeqOf::InsertAfter()
1221 AsnListElmt
*newElmt
;
1222 newElmt
= new AsnListElmt
;
1223 newElmt
->elmt
= new PolicyQualifierInfo
;
1226 newElmt
->prev
= last
;
1227 newElmt
->next
= NULL
;
1234 newElmt
->prev
= curr
;
1235 newElmt
->next
= curr
->next
;
1236 curr
->next
= newElmt
;
1240 newElmt
->next
->prev
= newElmt
;
1243 return (curr
= newElmt
)->elmt
;
1244 } // PolicyInformationSeqOf::InsertAfter
1247 PolicyInformationSeqOf
&PolicyInformationSeqOf::AppendCopy (PolicyQualifierInfo
&elmt
)
1249 AsnListElmt
*newElmt
;
1250 newElmt
= new AsnListElmt
;
1251 newElmt
->elmt
= new PolicyQualifierInfo
;
1252 *newElmt
->elmt
= elmt
;
1253 newElmt
->next
= NULL
;
1256 newElmt
->prev
= NULL
;
1257 first
= last
= newElmt
;
1261 newElmt
->prev
= last
;
1262 last
->next
= newElmt
;
1270 PolicyInformationSeqOf
&PolicyInformationSeqOf::PrependCopy (PolicyQualifierInfo
&elmt
)
1272 AsnListElmt
*newElmt
;
1273 newElmt
= new AsnListElmt
;
1274 newElmt
->elmt
= new PolicyQualifierInfo
;
1275 *newElmt
->elmt
= elmt
;
1276 newElmt
->prev
= NULL
;
1279 newElmt
->next
= NULL
;
1280 first
= last
= newElmt
;
1284 newElmt
->next
= first
;
1285 first
->prev
= newElmt
;
1290 } // PolicyInformationSeqOf::PrependCopy
1293 // alloc new list elmt, insert it before the
1294 // current element, copy the given elmt into the new elmt
1295 // and return the component type.
1296 // if the current element is null, the new element
1297 // is placed at the beginning of the list.
1298 PolicyInformationSeqOf
&PolicyInformationSeqOf::InsertBeforeAndCopy (PolicyQualifierInfo
&elmt
)
1300 AsnListElmt
*newElmt
;
1302 newElmt
= new AsnListElmt
;
1303 newElmt
->elmt
= new PolicyQualifierInfo
;
1304 *newElmt
->elmt
= elmt
;
1308 newElmt
->next
= first
;
1309 newElmt
->prev
= NULL
;
1316 newElmt
->next
= curr
;
1317 newElmt
->prev
= curr
->prev
;
1318 curr
->prev
= newElmt
;
1322 newElmt
->prev
->next
= newElmt
;
1326 } // PolicyInformationSeqOf::InsertBeforeAndCopy
1329 // alloc new list elmt, insert it after the
1330 // current element, copy given elmt in to new elmt
1331 // and return the component type
1332 // if the current element is null, the new element
1333 // is placed at the end of the list.
1334 PolicyInformationSeqOf
&PolicyInformationSeqOf::InsertAfterAndCopy (PolicyQualifierInfo
&elmt
)
1336 AsnListElmt
*newElmt
;
1338 newElmt
= new AsnListElmt
;
1339 newElmt
->elmt
= new PolicyQualifierInfo
;
1340 *newElmt
->elmt
= elmt
;
1343 newElmt
->prev
= last
;
1344 newElmt
->next
= NULL
;
1351 newElmt
->prev
= curr
;
1352 newElmt
->next
= curr
->next
;
1353 curr
->next
= newElmt
;
1357 newElmt
->next
->prev
= newElmt
;
1361 } // PolicyInformationSeqOf::InsertAfterAndCopy
1364 // remove current element from list if current element is not NULL
1365 // The new current element will be the next element.
1366 // If the current element is the last element in the list
1367 // the second but last element will become the new current element.
1368 void PolicyInformationSeqOf::RemoveCurrFromList()
1370 AsnListElmt
*del_elmt
;
1378 first
= last
= curr
= NULL
;
1379 else if (curr
== first
)
1381 curr
= first
= first
->next
;
1384 else if (curr
== last
)
1386 curr
= last
= last
->prev
;
1391 curr
->prev
->next
= curr
->next
;
1392 curr
->next
->prev
= curr
->prev
;
1395 delete del_elmt
->elmt
;
1401 AsnLen
PolicyInformationSeqOf::BEncContent (BUF_TYPE b
)
1403 AsnListElmt
*currElmt
;
1405 AsnLen totalLen
= 0;
1406 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
1409 elmtLen
= currElmt
->elmt
->BEncContent (b
);
1410 elmtLen
+= BEncConsLen (b
, elmtLen
);
1412 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1413 totalLen
+= elmtLen
;
1416 } // PolicyInformationSeqOf::BEncContent
1419 void PolicyInformationSeqOf::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
1420 AsnLen
&bytesDecoded
, ENV_TYPE env
)
1422 PolicyQualifierInfo
*listElmt
;
1424 AsnLen listBytesDecoded
= 0;
1427 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
1429 tag1
= BDecTag (b
, listBytesDecoded
, env
);
1430 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
1432 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
1435 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1437 Asn1Error
<< "Unexpected Tag" << endl
;
1438 SnaccExcep::throwMe(-111);
1441 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
1442 listElmt
= Append();
1443 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
1446 bytesDecoded
+= listBytesDecoded
;
1447 } // PolicyInformationSeqOf::BDecContent
1450 PolicyInformation::PolicyInformation()
1452 policyQualifiers
= NULL
;
1455 PolicyInformation::PolicyInformation (const PolicyInformation
&)
1457 Asn1Error
<< "use of incompletely defined PolicyInformation::PolicyInformation (const PolicyInformation &)" << endl
;
1461 PolicyInformation::~PolicyInformation()
1463 delete policyQualifiers
;
1466 AsnType
*PolicyInformation::Clone() const
1468 return new PolicyInformation
;
1471 AsnType
*PolicyInformation::Copy() const
1473 return new PolicyInformation (*this);
1477 PolicyInformation
&PolicyInformation::operator = (const PolicyInformation
&that
)
1478 #else // SNACC_DEEP_COPY
1479 PolicyInformation
&PolicyInformation::operator = (const PolicyInformation
&)
1480 #endif // SNACC_DEEP_COPY
1485 policyIdentifier
= that
.policyIdentifier
;
1486 if (that
.policyQualifiers
)
1488 if (!policyQualifiers
)
1489 policyQualifiers
= new PolicyInformationSeqOf
;
1490 *policyQualifiers
= *that
.policyQualifiers
;
1494 delete policyQualifiers
;
1495 policyQualifiers
= NULL
;
1500 #else // SNACC_DEEP_COPY
1501 Asn1Error
<< "use of incompletely defined PolicyInformation &PolicyInformation::operator = (const PolicyInformation &)" << endl
;
1503 // if your compiler complains here, check the -novolat option
1504 #endif // SNACC_DEEP_COPY
1508 PolicyInformation::BEncContent (BUF_TYPE b
)
1510 AsnLen totalLen
= 0;
1513 if (NOT_NULL (policyQualifiers
))
1516 l
= policyQualifiers
->BEncContent (b
);
1517 l
+= BEncConsLen (b
, l
);
1519 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1523 l
= policyIdentifier
.BEncContent (b
);
1524 l
+= BEncDefLen (b
, l
);
1526 l
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
1530 } // PolicyInformation::BEncContent
1533 void PolicyInformation::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1536 AsnLen seqBytesDecoded
= 0;
1538 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1540 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
1542 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1543 policyIdentifier
.BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1544 if (seqBytesDecoded
== elmtLen0
)
1546 bytesDecoded
+= seqBytesDecoded
;
1551 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1553 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1555 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
1556 bytesDecoded
+= seqBytesDecoded
;
1563 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1564 SnaccExcep::throwMe(-112);
1567 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
1569 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1570 policyQualifiers
= new PolicyInformationSeqOf
;
1571 policyQualifiers
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1574 bytesDecoded
+= seqBytesDecoded
;
1575 if (elmtLen0
== INDEFINITE_LEN
)
1577 BDecEoc (b
, bytesDecoded
, env
);
1580 else if (seqBytesDecoded
!= elmtLen0
)
1582 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1583 SnaccExcep::throwMe(-113);
1587 } // PolicyInformation::BDecContent
1589 AsnLen
PolicyInformation::BEnc (BUF_TYPE b
)
1592 l
= BEncContent (b
);
1593 l
+= BEncConsLen (b
, l
);
1594 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1598 void PolicyInformation::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1603 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1605 Asn1Error
<< "PolicyInformation::BDec: ERROR - wrong tag" << endl
;
1606 SnaccExcep::throwMe(-114);
1608 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1609 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1612 void PolicyInformation::Print (ostream
&os
) const
1615 os
<< "{ -- SEQUENCE --" << endl
;
1616 indentG
+= stdIndentG
;
1619 Indent (os
, indentG
);
1620 os
<< "policyIdentifier ";
1621 os
<< policyIdentifier
;
1625 if (NOT_NULL (policyQualifiers
))
1628 Indent (os
, indentG
);
1629 os
<< "policyQualifiers ";
1630 os
<< *policyQualifiers
;
1634 Indent (os
, indentG
);
1635 os
<< "policyQualifiers ";
1641 indentG
-= stdIndentG
;
1642 Indent (os
, indentG
);
1645 } // PolicyInformation::Print
1648 GeneralSubtree::GeneralSubtree()
1651 base
= new GeneralName
;
1653 base
= NULL
; // incomplete initialization of mandatory element!
1659 GeneralSubtree::GeneralSubtree (const GeneralSubtree
&)
1661 Asn1Error
<< "use of incompletely defined GeneralSubtree::GeneralSubtree (const GeneralSubtree &)" << endl
;
1665 GeneralSubtree::~GeneralSubtree()
1672 AsnType
*GeneralSubtree::Clone() const
1674 return new GeneralSubtree
;
1677 AsnType
*GeneralSubtree::Copy() const
1679 return new GeneralSubtree (*this);
1683 GeneralSubtree
&GeneralSubtree::operator = (const GeneralSubtree
&that
)
1684 #else // SNACC_DEEP_COPY
1685 GeneralSubtree
&GeneralSubtree::operator = (const GeneralSubtree
&)
1686 #endif // SNACC_DEEP_COPY
1694 base
= new GeneralName
;
1705 minimum
= new BaseDistance
;
1706 *minimum
= *that
.minimum
;
1716 maximum
= new BaseDistance
;
1717 *maximum
= *that
.maximum
;
1727 #else // SNACC_DEEP_COPY
1728 Asn1Error
<< "use of incompletely defined GeneralSubtree &GeneralSubtree::operator = (const GeneralSubtree &)" << endl
;
1730 // if your compiler complains here, check the -novolat option
1731 #endif // SNACC_DEEP_COPY
1735 GeneralSubtree::BEncContent (BUF_TYPE b
)
1737 AsnLen totalLen
= 0;
1740 if (NOT_NULL (maximum
))
1742 l
= maximum
->BEncContent (b
);
1743 BEncDefLenTo127 (b
, l
);
1746 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
1750 if (NOT_NULL (minimum
))
1752 l
= minimum
->BEncContent (b
);
1753 BEncDefLenTo127 (b
, l
);
1756 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
1760 l
= base
->BEncContent (b
);
1764 } // GeneralSubtree::BEncContent
1767 void GeneralSubtree::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1770 AsnLen seqBytesDecoded
= 0;
1772 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1774 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
1775 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))
1776 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1))
1777 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 2))
1778 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2))
1779 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 3))
1780 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 4))
1781 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 5))
1782 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 6))
1783 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 6))
1784 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 7))
1785 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 7))
1786 || (tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 8)))
1788 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1789 base
= new GeneralName
;
1790 base
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1791 if (seqBytesDecoded
== elmtLen0
)
1793 bytesDecoded
+= seqBytesDecoded
;
1798 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1800 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1802 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
1803 bytesDecoded
+= seqBytesDecoded
;
1810 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
1811 SnaccExcep::throwMe(-115);
1814 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0)))
1816 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1817 minimum
= new BaseDistance
;
1818 minimum
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1819 if (seqBytesDecoded
== elmtLen0
)
1821 bytesDecoded
+= seqBytesDecoded
;
1826 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
1828 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
1830 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
1831 bytesDecoded
+= seqBytesDecoded
;
1837 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1)))
1839 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
1840 maximum
= new BaseDistance
;
1841 maximum
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
1844 bytesDecoded
+= seqBytesDecoded
;
1845 if (elmtLen0
== INDEFINITE_LEN
)
1847 BDecEoc (b
, bytesDecoded
, env
);
1850 else if (seqBytesDecoded
!= elmtLen0
)
1852 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
1853 SnaccExcep::throwMe(-116);
1857 } // GeneralSubtree::BDecContent
1859 AsnLen
GeneralSubtree::BEnc (BUF_TYPE b
)
1862 l
= BEncContent (b
);
1863 l
+= BEncConsLen (b
, l
);
1864 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
1868 void GeneralSubtree::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
1873 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
1875 Asn1Error
<< "GeneralSubtree::BDec: ERROR - wrong tag" << endl
;
1876 SnaccExcep::throwMe(-117);
1878 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
1879 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
1882 void GeneralSubtree::Print (ostream
&os
) const
1885 os
<< "{ -- SEQUENCE --" << endl
;
1886 indentG
+= stdIndentG
;
1888 if (NOT_NULL (base
))
1890 Indent (os
, indentG
);
1896 Indent (os
, indentG
);
1902 if (NOT_NULL (minimum
))
1905 Indent (os
, indentG
);
1911 Indent (os
, indentG
);
1917 if (NOT_NULL (maximum
))
1920 Indent (os
, indentG
);
1926 Indent (os
, indentG
);
1933 indentG
-= stdIndentG
;
1934 Indent (os
, indentG
);
1937 } // GeneralSubtree::Print
1940 DistributionPoint::DistributionPoint()
1942 distributionPoint
= NULL
;
1947 DistributionPoint::DistributionPoint (const DistributionPoint
&)
1949 Asn1Error
<< "use of incompletely defined DistributionPoint::DistributionPoint (const DistributionPoint &)" << endl
;
1953 DistributionPoint::~DistributionPoint()
1955 delete distributionPoint
;
1960 AsnType
*DistributionPoint::Clone() const
1962 return new DistributionPoint
;
1965 AsnType
*DistributionPoint::Copy() const
1967 return new DistributionPoint (*this);
1971 DistributionPoint
&DistributionPoint::operator = (const DistributionPoint
&that
)
1972 #else // SNACC_DEEP_COPY
1973 DistributionPoint
&DistributionPoint::operator = (const DistributionPoint
&)
1974 #endif // SNACC_DEEP_COPY
1979 if (that
.distributionPoint
)
1981 if (!distributionPoint
)
1982 distributionPoint
= new DistributionPointName
;
1983 *distributionPoint
= *that
.distributionPoint
;
1987 delete distributionPoint
;
1988 distributionPoint
= NULL
;
1993 reasons
= new ReasonFlags
;
1994 *reasons
= *that
.reasons
;
2004 cRLIssuer
= new GeneralNames
;
2005 *cRLIssuer
= *that
.cRLIssuer
;
2015 #else // SNACC_DEEP_COPY
2016 Asn1Error
<< "use of incompletely defined DistributionPoint &DistributionPoint::operator = (const DistributionPoint &)" << endl
;
2018 // if your compiler complains here, check the -novolat option
2019 #endif // SNACC_DEEP_COPY
2023 DistributionPoint::BEncContent (BUF_TYPE b
)
2025 AsnLen totalLen
= 0;
2028 if (NOT_NULL (cRLIssuer
))
2031 l
= cRLIssuer
->BEncContent (b
);
2032 l
+= BEncConsLen (b
, l
);
2034 l
+= BEncTag1 (b
, CNTX
, CONS
, 2);
2038 if (NOT_NULL (reasons
))
2040 l
= reasons
->BEncContent (b
);
2041 l
+= BEncDefLen (b
, l
);
2043 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
2047 if (NOT_NULL (distributionPoint
))
2050 l
= distributionPoint
->BEncContent (b
);
2051 l
+= BEncConsLen (b
, l
);
2053 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
2058 } // DistributionPoint::BEncContent
2061 void DistributionPoint::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2064 AsnLen seqBytesDecoded
= 0;
2071 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2073 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
2075 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
2076 bytesDecoded
+= seqBytesDecoded
;
2081 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
2083 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2084 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2085 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
2086 distributionPoint
= new DistributionPointName
;
2087 distributionPoint
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
2088 if (elmtLen1
== INDEFINITE_LEN
)
2089 BDecEoc (b
, seqBytesDecoded
, env
);
2091 if (seqBytesDecoded
== elmtLen0
)
2093 bytesDecoded
+= seqBytesDecoded
;
2098 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2100 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
2102 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
2103 bytesDecoded
+= seqBytesDecoded
;
2109 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))
2110 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
2112 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2113 reasons
= new ReasonFlags
;
2114 reasons
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
2115 if (seqBytesDecoded
== elmtLen0
)
2117 bytesDecoded
+= seqBytesDecoded
;
2122 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
2124 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
2126 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
2127 bytesDecoded
+= seqBytesDecoded
;
2133 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2)))
2135 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
2136 cRLIssuer
= new GeneralNames
;
2137 cRLIssuer
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
2140 bytesDecoded
+= seqBytesDecoded
;
2141 if (elmtLen0
== INDEFINITE_LEN
)
2143 BDecEoc (b
, bytesDecoded
, env
);
2146 else if (seqBytesDecoded
!= elmtLen0
)
2148 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
2149 SnaccExcep::throwMe(-118);
2153 } // DistributionPoint::BDecContent
2155 AsnLen
DistributionPoint::BEnc (BUF_TYPE b
)
2158 l
= BEncContent (b
);
2159 l
+= BEncConsLen (b
, l
);
2160 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2164 void DistributionPoint::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2169 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2171 Asn1Error
<< "DistributionPoint::BDec: ERROR - wrong tag" << endl
;
2172 SnaccExcep::throwMe(-119);
2174 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2175 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2178 void DistributionPoint::Print (ostream
&os
) const
2181 int nonePrinted
= true;
2182 os
<< "{ -- SEQUENCE --" << endl
;
2183 indentG
+= stdIndentG
;
2185 if (NOT_NULL (distributionPoint
))
2187 nonePrinted
= false;
2188 Indent (os
, indentG
);
2189 os
<< "distributionPoint ";
2190 os
<< *distributionPoint
;
2194 Indent (os
, indentG
);
2195 os
<< "distributionPoint ";
2200 if (NOT_NULL (reasons
))
2204 nonePrinted
= false;
2205 Indent (os
, indentG
);
2211 Indent (os
, indentG
);
2217 if (NOT_NULL (cRLIssuer
))
2221 nonePrinted
= false;
2222 Indent (os
, indentG
);
2228 Indent (os
, indentG
);
2235 indentG
-= stdIndentG
;
2236 Indent (os
, indentG
);
2239 } // DistributionPoint::Print
2242 AsnType
*CertificatePoliciesSyntax::Clone() const
2244 return new CertificatePoliciesSyntax
;
2247 AsnType
*CertificatePoliciesSyntax::Copy() const
2249 return new CertificatePoliciesSyntax (*this);
2252 AsnLen
CertificatePoliciesSyntax::BEnc (BUF_TYPE b
)
2255 l
= BEncContent (b
);
2256 l
+= BEncConsLen (b
, l
);
2257 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2261 void CertificatePoliciesSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2266 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2268 Asn1Error
<< "CertificatePoliciesSyntax::BDec: ERROR - wrong tag" << endl
;
2269 SnaccExcep::throwMe(-120);
2271 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2272 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2275 CertificatePoliciesSyntax::CertificatePoliciesSyntax (const CertificatePoliciesSyntax
&)
2277 Asn1Error
<< "use of incompletely defined CertificatePoliciesSyntax::CertificatePoliciesSyntax (const CertificatePoliciesSyntax &)" << endl
;
2281 CertificatePoliciesSyntax::~CertificatePoliciesSyntax()
2284 for (; Curr() != NULL
; RemoveCurrFromList())
2286 } // end of destructor
2289 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::operator = (const CertificatePoliciesSyntax
&that
)
2290 #else // SNACC_DEEP_COPY
2291 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::operator = (const CertificatePoliciesSyntax
&)
2292 #endif // SNACC_DEEP_COPY
2298 for (; Curr(); RemoveCurrFromList())
2301 //that.SetCurrToFirst();
2302 //for (; that.Curr(); that.GoNext())
2303 // AppendCopy (*that.Curr());
2304 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2305 AppendCopy (*run
->elmt
);
2309 #else // SNACC_DEEP_COPY
2310 Asn1Error
<< "use of incompletely defined CertificatePoliciesSyntax &CertificatePoliciesSyntax::operator = (const CertificatePoliciesSyntax &)" << endl
;
2312 // if your compiler complains here, check the -novolat option
2313 #endif // SNACC_DEEP_COPY
2316 void CertificatePoliciesSyntax::Print (ostream
&os
) const
2319 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2320 indentG
+= stdIndentG
;
2322 //for (; Curr() != NULL; GoNext())
2323 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2325 Indent (os
, indentG
);
2328 //if (Curr() != Last())
2333 indentG
-= stdIndentG
;
2334 Indent (os
, indentG
);
2342 void CertificatePoliciesSyntax::SetCurrElmt (unsigned long int index
)
2344 unsigned long int i
;
2347 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2349 } // CertificatePoliciesSyntax::SetCurrElmt
2352 unsigned long int CertificatePoliciesSyntax::GetCurrElmtIndex()
2354 unsigned long int i
;
2358 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2367 } // CertificatePoliciesSyntax::GetCurrElmtIndex
2370 // alloc new list elmt, put at end of list
2371 // and return the component type
2372 PolicyInformation
*CertificatePoliciesSyntax::Append()
2374 AsnListElmt
*newElmt
;
2375 newElmt
= new AsnListElmt
;
2376 newElmt
->elmt
= new PolicyInformation
;
2377 newElmt
->next
= NULL
;
2380 newElmt
->prev
= NULL
;
2381 first
= last
= newElmt
;
2385 newElmt
->prev
= last
;
2386 last
->next
= newElmt
;
2390 return (curr
= newElmt
)->elmt
;
2391 } // CertificatePoliciesSyntax::Append
2394 // alloc new list elmt, put at begining of list
2395 // and return the component type
2396 PolicyInformation
*CertificatePoliciesSyntax::Prepend()
2398 AsnListElmt
*newElmt
;
2399 newElmt
= new AsnListElmt
;
2400 newElmt
->elmt
= new PolicyInformation
;
2401 newElmt
->prev
= NULL
;
2404 newElmt
->next
= NULL
;
2405 first
= last
= newElmt
;
2409 newElmt
->next
= first
;
2410 first
->prev
= newElmt
;
2414 return (curr
= newElmt
)->elmt
;
2415 } // CertificatePoliciesSyntax::Prepend
2418 // alloc new list elmt, insert it before the
2419 // current element and return the component type
2420 // if the current element is null, the new element
2421 // is placed at the beginning of the list.
2422 PolicyInformation
*CertificatePoliciesSyntax::InsertBefore()
2424 AsnListElmt
*newElmt
;
2425 newElmt
= new AsnListElmt
;
2426 newElmt
->elmt
= new PolicyInformation
;
2429 newElmt
->next
= first
;
2430 newElmt
->prev
= NULL
;
2437 newElmt
->next
= curr
;
2438 newElmt
->prev
= curr
->prev
;
2439 curr
->prev
= newElmt
;
2443 newElmt
->prev
->next
= newElmt
;
2446 return (curr
= newElmt
)->elmt
;
2447 } // CertificatePoliciesSyntax::InsertBefore
2450 // alloc new list elmt, insert it after the
2451 // current element and return the component type
2452 // if the current element is null, the new element
2453 // is placed at the end of the list.
2454 PolicyInformation
*CertificatePoliciesSyntax::InsertAfter()
2456 AsnListElmt
*newElmt
;
2457 newElmt
= new AsnListElmt
;
2458 newElmt
->elmt
= new PolicyInformation
;
2461 newElmt
->prev
= last
;
2462 newElmt
->next
= NULL
;
2469 newElmt
->prev
= curr
;
2470 newElmt
->next
= curr
->next
;
2471 curr
->next
= newElmt
;
2475 newElmt
->next
->prev
= newElmt
;
2478 return (curr
= newElmt
)->elmt
;
2479 } // CertificatePoliciesSyntax::InsertAfter
2482 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::AppendCopy (PolicyInformation
&elmt
)
2484 AsnListElmt
*newElmt
;
2485 newElmt
= new AsnListElmt
;
2486 newElmt
->elmt
= new PolicyInformation
;
2487 *newElmt
->elmt
= elmt
;
2488 newElmt
->next
= NULL
;
2491 newElmt
->prev
= NULL
;
2492 first
= last
= newElmt
;
2496 newElmt
->prev
= last
;
2497 last
->next
= newElmt
;
2505 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::PrependCopy (PolicyInformation
&elmt
)
2507 AsnListElmt
*newElmt
;
2508 newElmt
= new AsnListElmt
;
2509 newElmt
->elmt
= new PolicyInformation
;
2510 *newElmt
->elmt
= elmt
;
2511 newElmt
->prev
= NULL
;
2514 newElmt
->next
= NULL
;
2515 first
= last
= newElmt
;
2519 newElmt
->next
= first
;
2520 first
->prev
= newElmt
;
2525 } // CertificatePoliciesSyntax::PrependCopy
2528 // alloc new list elmt, insert it before the
2529 // current element, copy the given elmt into the new elmt
2530 // and return the component type.
2531 // if the current element is null, the new element
2532 // is placed at the beginning of the list.
2533 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::InsertBeforeAndCopy (PolicyInformation
&elmt
)
2535 AsnListElmt
*newElmt
;
2537 newElmt
= new AsnListElmt
;
2538 newElmt
->elmt
= new PolicyInformation
;
2539 *newElmt
->elmt
= elmt
;
2543 newElmt
->next
= first
;
2544 newElmt
->prev
= NULL
;
2551 newElmt
->next
= curr
;
2552 newElmt
->prev
= curr
->prev
;
2553 curr
->prev
= newElmt
;
2557 newElmt
->prev
->next
= newElmt
;
2561 } // CertificatePoliciesSyntax::InsertBeforeAndCopy
2564 // alloc new list elmt, insert it after the
2565 // current element, copy given elmt in to new elmt
2566 // and return the component type
2567 // if the current element is null, the new element
2568 // is placed at the end of the list.
2569 CertificatePoliciesSyntax
&CertificatePoliciesSyntax::InsertAfterAndCopy (PolicyInformation
&elmt
)
2571 AsnListElmt
*newElmt
;
2573 newElmt
= new AsnListElmt
;
2574 newElmt
->elmt
= new PolicyInformation
;
2575 *newElmt
->elmt
= elmt
;
2578 newElmt
->prev
= last
;
2579 newElmt
->next
= NULL
;
2586 newElmt
->prev
= curr
;
2587 newElmt
->next
= curr
->next
;
2588 curr
->next
= newElmt
;
2592 newElmt
->next
->prev
= newElmt
;
2596 } // CertificatePoliciesSyntax::InsertAfterAndCopy
2599 // remove current element from list if current element is not NULL
2600 // The new current element will be the next element.
2601 // If the current element is the last element in the list
2602 // the second but last element will become the new current element.
2603 void CertificatePoliciesSyntax::RemoveCurrFromList()
2605 AsnListElmt
*del_elmt
;
2613 first
= last
= curr
= NULL
;
2614 else if (curr
== first
)
2616 curr
= first
= first
->next
;
2619 else if (curr
== last
)
2621 curr
= last
= last
->prev
;
2626 curr
->prev
->next
= curr
->next
;
2627 curr
->next
->prev
= curr
->prev
;
2630 delete del_elmt
->elmt
;
2636 AsnLen
CertificatePoliciesSyntax::BEncContent (BUF_TYPE b
)
2638 AsnListElmt
*currElmt
;
2640 AsnLen totalLen
= 0;
2641 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
2644 elmtLen
= currElmt
->elmt
->BEncContent (b
);
2645 elmtLen
+= BEncConsLen (b
, elmtLen
);
2647 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2648 totalLen
+= elmtLen
;
2651 } // CertificatePoliciesSyntax::BEncContent
2654 void CertificatePoliciesSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
2655 AsnLen
&bytesDecoded
, ENV_TYPE env
)
2657 PolicyInformation
*listElmt
;
2659 AsnLen listBytesDecoded
= 0;
2662 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
2664 tag1
= BDecTag (b
, listBytesDecoded
, env
);
2665 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
2667 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
2670 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
2672 Asn1Error
<< "Unexpected Tag" << endl
;
2673 SnaccExcep::throwMe(-121);
2676 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
2677 listElmt
= Append();
2678 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
2681 bytesDecoded
+= listBytesDecoded
;
2682 } // CertificatePoliciesSyntax::BDecContent
2685 AsnType
*GeneralSubtrees::Clone() const
2687 return new GeneralSubtrees
;
2690 AsnType
*GeneralSubtrees::Copy() const
2692 return new GeneralSubtrees (*this);
2695 AsnLen
GeneralSubtrees::BEnc (BUF_TYPE b
)
2698 l
= BEncContent (b
);
2699 l
+= BEncConsLen (b
, l
);
2700 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
2704 void GeneralSubtrees::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
2709 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
2711 Asn1Error
<< "GeneralSubtrees::BDec: ERROR - wrong tag" << endl
;
2712 SnaccExcep::throwMe(-122);
2714 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
2715 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
2718 GeneralSubtrees::GeneralSubtrees (const GeneralSubtrees
&)
2720 Asn1Error
<< "use of incompletely defined GeneralSubtrees::GeneralSubtrees (const GeneralSubtrees &)" << endl
;
2724 GeneralSubtrees::~GeneralSubtrees()
2727 for (; Curr() != NULL
; RemoveCurrFromList())
2729 } // end of destructor
2732 GeneralSubtrees
&GeneralSubtrees::operator = (const GeneralSubtrees
&that
)
2733 #else // SNACC_DEEP_COPY
2734 GeneralSubtrees
&GeneralSubtrees::operator = (const GeneralSubtrees
&)
2735 #endif // SNACC_DEEP_COPY
2741 for (; Curr(); RemoveCurrFromList())
2744 //that.SetCurrToFirst();
2745 //for (; that.Curr(); that.GoNext())
2746 // AppendCopy (*that.Curr());
2747 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
2748 AppendCopy (*run
->elmt
);
2752 #else // SNACC_DEEP_COPY
2753 Asn1Error
<< "use of incompletely defined GeneralSubtrees &GeneralSubtrees::operator = (const GeneralSubtrees &)" << endl
;
2755 // if your compiler complains here, check the -novolat option
2756 #endif // SNACC_DEEP_COPY
2759 void GeneralSubtrees::Print (ostream
&os
) const
2762 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
2763 indentG
+= stdIndentG
;
2765 //for (; Curr() != NULL; GoNext())
2766 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
2768 Indent (os
, indentG
);
2771 //if (Curr() != Last())
2776 indentG
-= stdIndentG
;
2777 Indent (os
, indentG
);
2785 void GeneralSubtrees::SetCurrElmt (unsigned long int index
)
2787 unsigned long int i
;
2790 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
2792 } // GeneralSubtrees::SetCurrElmt
2795 unsigned long int GeneralSubtrees::GetCurrElmtIndex()
2797 unsigned long int i
;
2801 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
2810 } // GeneralSubtrees::GetCurrElmtIndex
2813 // alloc new list elmt, put at end of list
2814 // and return the component type
2815 GeneralSubtree
*GeneralSubtrees::Append()
2817 AsnListElmt
*newElmt
;
2818 newElmt
= new AsnListElmt
;
2819 newElmt
->elmt
= new GeneralSubtree
;
2820 newElmt
->next
= NULL
;
2823 newElmt
->prev
= NULL
;
2824 first
= last
= newElmt
;
2828 newElmt
->prev
= last
;
2829 last
->next
= newElmt
;
2833 return (curr
= newElmt
)->elmt
;
2834 } // GeneralSubtrees::Append
2837 // alloc new list elmt, put at begining of list
2838 // and return the component type
2839 GeneralSubtree
*GeneralSubtrees::Prepend()
2841 AsnListElmt
*newElmt
;
2842 newElmt
= new AsnListElmt
;
2843 newElmt
->elmt
= new GeneralSubtree
;
2844 newElmt
->prev
= NULL
;
2847 newElmt
->next
= NULL
;
2848 first
= last
= newElmt
;
2852 newElmt
->next
= first
;
2853 first
->prev
= newElmt
;
2857 return (curr
= newElmt
)->elmt
;
2858 } // GeneralSubtrees::Prepend
2861 // alloc new list elmt, insert it before the
2862 // current element and return the component type
2863 // if the current element is null, the new element
2864 // is placed at the beginning of the list.
2865 GeneralSubtree
*GeneralSubtrees::InsertBefore()
2867 AsnListElmt
*newElmt
;
2868 newElmt
= new AsnListElmt
;
2869 newElmt
->elmt
= new GeneralSubtree
;
2872 newElmt
->next
= first
;
2873 newElmt
->prev
= NULL
;
2880 newElmt
->next
= curr
;
2881 newElmt
->prev
= curr
->prev
;
2882 curr
->prev
= newElmt
;
2886 newElmt
->prev
->next
= newElmt
;
2889 return (curr
= newElmt
)->elmt
;
2890 } // GeneralSubtrees::InsertBefore
2893 // alloc new list elmt, insert it after the
2894 // current element and return the component type
2895 // if the current element is null, the new element
2896 // is placed at the end of the list.
2897 GeneralSubtree
*GeneralSubtrees::InsertAfter()
2899 AsnListElmt
*newElmt
;
2900 newElmt
= new AsnListElmt
;
2901 newElmt
->elmt
= new GeneralSubtree
;
2904 newElmt
->prev
= last
;
2905 newElmt
->next
= NULL
;
2912 newElmt
->prev
= curr
;
2913 newElmt
->next
= curr
->next
;
2914 curr
->next
= newElmt
;
2918 newElmt
->next
->prev
= newElmt
;
2921 return (curr
= newElmt
)->elmt
;
2922 } // GeneralSubtrees::InsertAfter
2925 GeneralSubtrees
&GeneralSubtrees::AppendCopy (GeneralSubtree
&elmt
)
2927 AsnListElmt
*newElmt
;
2928 newElmt
= new AsnListElmt
;
2929 newElmt
->elmt
= new GeneralSubtree
;
2930 *newElmt
->elmt
= elmt
;
2931 newElmt
->next
= NULL
;
2934 newElmt
->prev
= NULL
;
2935 first
= last
= newElmt
;
2939 newElmt
->prev
= last
;
2940 last
->next
= newElmt
;
2948 GeneralSubtrees
&GeneralSubtrees::PrependCopy (GeneralSubtree
&elmt
)
2950 AsnListElmt
*newElmt
;
2951 newElmt
= new AsnListElmt
;
2952 newElmt
->elmt
= new GeneralSubtree
;
2953 *newElmt
->elmt
= elmt
;
2954 newElmt
->prev
= NULL
;
2957 newElmt
->next
= NULL
;
2958 first
= last
= newElmt
;
2962 newElmt
->next
= first
;
2963 first
->prev
= newElmt
;
2968 } // GeneralSubtrees::PrependCopy
2971 // alloc new list elmt, insert it before the
2972 // current element, copy the given elmt into the new elmt
2973 // and return the component type.
2974 // if the current element is null, the new element
2975 // is placed at the beginning of the list.
2976 GeneralSubtrees
&GeneralSubtrees::InsertBeforeAndCopy (GeneralSubtree
&elmt
)
2978 AsnListElmt
*newElmt
;
2980 newElmt
= new AsnListElmt
;
2981 newElmt
->elmt
= new GeneralSubtree
;
2982 *newElmt
->elmt
= elmt
;
2986 newElmt
->next
= first
;
2987 newElmt
->prev
= NULL
;
2994 newElmt
->next
= curr
;
2995 newElmt
->prev
= curr
->prev
;
2996 curr
->prev
= newElmt
;
3000 newElmt
->prev
->next
= newElmt
;
3004 } // GeneralSubtrees::InsertBeforeAndCopy
3007 // alloc new list elmt, insert it after the
3008 // current element, copy given elmt in to new elmt
3009 // and return the component type
3010 // if the current element is null, the new element
3011 // is placed at the end of the list.
3012 GeneralSubtrees
&GeneralSubtrees::InsertAfterAndCopy (GeneralSubtree
&elmt
)
3014 AsnListElmt
*newElmt
;
3016 newElmt
= new AsnListElmt
;
3017 newElmt
->elmt
= new GeneralSubtree
;
3018 *newElmt
->elmt
= elmt
;
3021 newElmt
->prev
= last
;
3022 newElmt
->next
= NULL
;
3029 newElmt
->prev
= curr
;
3030 newElmt
->next
= curr
->next
;
3031 curr
->next
= newElmt
;
3035 newElmt
->next
->prev
= newElmt
;
3039 } // GeneralSubtrees::InsertAfterAndCopy
3042 // remove current element from list if current element is not NULL
3043 // The new current element will be the next element.
3044 // If the current element is the last element in the list
3045 // the second but last element will become the new current element.
3046 void GeneralSubtrees::RemoveCurrFromList()
3048 AsnListElmt
*del_elmt
;
3056 first
= last
= curr
= NULL
;
3057 else if (curr
== first
)
3059 curr
= first
= first
->next
;
3062 else if (curr
== last
)
3064 curr
= last
= last
->prev
;
3069 curr
->prev
->next
= curr
->next
;
3070 curr
->next
->prev
= curr
->prev
;
3073 delete del_elmt
->elmt
;
3079 AsnLen
GeneralSubtrees::BEncContent (BUF_TYPE b
)
3081 AsnListElmt
*currElmt
;
3083 AsnLen totalLen
= 0;
3084 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
3087 elmtLen
= currElmt
->elmt
->BEncContent (b
);
3088 elmtLen
+= BEncConsLen (b
, elmtLen
);
3090 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3091 totalLen
+= elmtLen
;
3094 } // GeneralSubtrees::BEncContent
3097 void GeneralSubtrees::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
3098 AsnLen
&bytesDecoded
, ENV_TYPE env
)
3100 GeneralSubtree
*listElmt
;
3102 AsnLen listBytesDecoded
= 0;
3105 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
3107 tag1
= BDecTag (b
, listBytesDecoded
, env
);
3108 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
3110 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
3113 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
3115 Asn1Error
<< "Unexpected Tag" << endl
;
3116 SnaccExcep::throwMe(-123);
3119 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
3120 listElmt
= Append();
3121 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
3124 bytesDecoded
+= listBytesDecoded
;
3125 } // GeneralSubtrees::BDecContent
3128 AuthorityKeyIdentifier::AuthorityKeyIdentifier()
3130 keyIdentifier
= NULL
;
3131 authorityCertIssuer
= NULL
;
3132 authorityCertSerialNumber
= NULL
;
3135 AuthorityKeyIdentifier::AuthorityKeyIdentifier (const AuthorityKeyIdentifier
&)
3137 Asn1Error
<< "use of incompletely defined AuthorityKeyIdentifier::AuthorityKeyIdentifier (const AuthorityKeyIdentifier &)" << endl
;
3141 AuthorityKeyIdentifier::~AuthorityKeyIdentifier()
3143 delete keyIdentifier
;
3144 delete authorityCertIssuer
;
3145 delete authorityCertSerialNumber
;
3148 AsnType
*AuthorityKeyIdentifier::Clone() const
3150 return new AuthorityKeyIdentifier
;
3153 AsnType
*AuthorityKeyIdentifier::Copy() const
3155 return new AuthorityKeyIdentifier (*this);
3159 AuthorityKeyIdentifier
&AuthorityKeyIdentifier::operator = (const AuthorityKeyIdentifier
&that
)
3160 #else // SNACC_DEEP_COPY
3161 AuthorityKeyIdentifier
&AuthorityKeyIdentifier::operator = (const AuthorityKeyIdentifier
&)
3162 #endif // SNACC_DEEP_COPY
3167 if (that
.keyIdentifier
)
3170 keyIdentifier
= new KeyIdentifier
;
3171 *keyIdentifier
= *that
.keyIdentifier
;
3175 delete keyIdentifier
;
3176 keyIdentifier
= NULL
;
3178 if (that
.authorityCertIssuer
)
3180 if (!authorityCertIssuer
)
3181 authorityCertIssuer
= new GeneralNames
;
3182 *authorityCertIssuer
= *that
.authorityCertIssuer
;
3186 delete authorityCertIssuer
;
3187 authorityCertIssuer
= NULL
;
3189 if (that
.authorityCertSerialNumber
)
3191 if (!authorityCertSerialNumber
)
3192 authorityCertSerialNumber
= new CertificateSerialNumber
;
3193 *authorityCertSerialNumber
= *that
.authorityCertSerialNumber
;
3197 delete authorityCertSerialNumber
;
3198 authorityCertSerialNumber
= NULL
;
3203 #else // SNACC_DEEP_COPY
3204 Asn1Error
<< "use of incompletely defined AuthorityKeyIdentifier &AuthorityKeyIdentifier::operator = (const AuthorityKeyIdentifier &)" << endl
;
3206 // if your compiler complains here, check the -novolat option
3207 #endif // SNACC_DEEP_COPY
3211 AuthorityKeyIdentifier::BEncContent (BUF_TYPE b
)
3213 AsnLen totalLen
= 0;
3216 if (NOT_NULL (authorityCertSerialNumber
))
3218 l
= authorityCertSerialNumber
->BEncContent (b
);
3219 l
+= BEncDefLen (b
, l
);
3221 l
+= BEncTag1 (b
, CNTX
, PRIM
, 2);
3225 if (NOT_NULL (authorityCertIssuer
))
3228 l
= authorityCertIssuer
->BEncContent (b
);
3229 l
+= BEncConsLen (b
, l
);
3231 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
3235 if (NOT_NULL (keyIdentifier
))
3237 l
= keyIdentifier
->BEncContent (b
);
3238 l
+= BEncDefLen (b
, l
);
3240 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
3245 } // AuthorityKeyIdentifier::BEncContent
3248 void AuthorityKeyIdentifier::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3251 AsnLen seqBytesDecoded
= 0;
3257 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3259 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3261 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3262 bytesDecoded
+= seqBytesDecoded
;
3267 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
3268 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
3270 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3271 keyIdentifier
= new KeyIdentifier
;
3272 keyIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3273 if (seqBytesDecoded
== elmtLen0
)
3275 bytesDecoded
+= seqBytesDecoded
;
3280 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3282 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3284 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3285 bytesDecoded
+= seqBytesDecoded
;
3291 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
3293 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3294 authorityCertIssuer
= new GeneralNames
;
3295 authorityCertIssuer
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3296 if (seqBytesDecoded
== elmtLen0
)
3298 bytesDecoded
+= seqBytesDecoded
;
3303 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3305 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3307 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3308 bytesDecoded
+= seqBytesDecoded
;
3314 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 2))
3315 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 2)))
3317 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3318 authorityCertSerialNumber
= new CertificateSerialNumber
;
3319 authorityCertSerialNumber
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3322 bytesDecoded
+= seqBytesDecoded
;
3323 if (elmtLen0
== INDEFINITE_LEN
)
3325 BDecEoc (b
, bytesDecoded
, env
);
3328 else if (seqBytesDecoded
!= elmtLen0
)
3330 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
3331 SnaccExcep::throwMe(-124);
3335 } // AuthorityKeyIdentifier::BDecContent
3337 AsnLen
AuthorityKeyIdentifier::BEnc (BUF_TYPE b
)
3340 l
= BEncContent (b
);
3341 l
+= BEncConsLen (b
, l
);
3342 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3346 void AuthorityKeyIdentifier::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3351 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3353 Asn1Error
<< "AuthorityKeyIdentifier::BDec: ERROR - wrong tag" << endl
;
3354 SnaccExcep::throwMe(-125);
3356 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3357 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3360 void AuthorityKeyIdentifier::Print (ostream
&os
) const
3363 int nonePrinted
= true;
3364 os
<< "{ -- SEQUENCE --" << endl
;
3365 indentG
+= stdIndentG
;
3367 if (NOT_NULL (keyIdentifier
))
3369 nonePrinted
= false;
3370 Indent (os
, indentG
);
3371 os
<< "keyIdentifier ";
3372 os
<< *keyIdentifier
;
3376 Indent (os
, indentG
);
3377 os
<< "keyIdentifier ";
3382 if (NOT_NULL (authorityCertIssuer
))
3386 nonePrinted
= false;
3387 Indent (os
, indentG
);
3388 os
<< "authorityCertIssuer ";
3389 os
<< *authorityCertIssuer
;
3393 Indent (os
, indentG
);
3394 os
<< "authorityCertIssuer ";
3399 if (NOT_NULL (authorityCertSerialNumber
))
3403 nonePrinted
= false;
3404 Indent (os
, indentG
);
3405 os
<< "authorityCertSerialNumber ";
3406 os
<< *authorityCertSerialNumber
;
3410 Indent (os
, indentG
);
3411 os
<< "authorityCertSerialNumber ";
3417 indentG
-= stdIndentG
;
3418 Indent (os
, indentG
);
3421 } // AuthorityKeyIdentifier::Print
3424 AsnType
*ExtKeyUsageSyntax::Clone() const
3426 return new ExtKeyUsageSyntax
;
3429 AsnType
*ExtKeyUsageSyntax::Copy() const
3431 return new ExtKeyUsageSyntax (*this);
3434 AsnLen
ExtKeyUsageSyntax::BEnc (BUF_TYPE b
)
3437 l
= BEncContent (b
);
3438 l
+= BEncConsLen (b
, l
);
3439 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
3443 void ExtKeyUsageSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3448 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
3450 Asn1Error
<< "ExtKeyUsageSyntax::BDec: ERROR - wrong tag" << endl
;
3451 SnaccExcep::throwMe(-126);
3453 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
3454 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
3457 ExtKeyUsageSyntax::ExtKeyUsageSyntax (const ExtKeyUsageSyntax
&)
3459 Asn1Error
<< "use of incompletely defined ExtKeyUsageSyntax::ExtKeyUsageSyntax (const ExtKeyUsageSyntax &)" << endl
;
3463 ExtKeyUsageSyntax::~ExtKeyUsageSyntax()
3466 for (; Curr() != NULL
; RemoveCurrFromList())
3468 } // end of destructor
3471 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::operator = (const ExtKeyUsageSyntax
&that
)
3472 #else // SNACC_DEEP_COPY
3473 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::operator = (const ExtKeyUsageSyntax
&)
3474 #endif // SNACC_DEEP_COPY
3480 for (; Curr(); RemoveCurrFromList())
3483 //that.SetCurrToFirst();
3484 //for (; that.Curr(); that.GoNext())
3485 // AppendCopy (*that.Curr());
3486 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
3487 AppendCopy (*run
->elmt
);
3491 #else // SNACC_DEEP_COPY
3492 Asn1Error
<< "use of incompletely defined ExtKeyUsageSyntax &ExtKeyUsageSyntax::operator = (const ExtKeyUsageSyntax &)" << endl
;
3494 // if your compiler complains here, check the -novolat option
3495 #endif // SNACC_DEEP_COPY
3498 void ExtKeyUsageSyntax::Print (ostream
&os
) const
3501 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
3502 indentG
+= stdIndentG
;
3504 //for (; Curr() != NULL; GoNext())
3505 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
3507 Indent (os
, indentG
);
3510 //if (Curr() != Last())
3515 indentG
-= stdIndentG
;
3516 Indent (os
, indentG
);
3524 void ExtKeyUsageSyntax::SetCurrElmt (unsigned long int index
)
3526 unsigned long int i
;
3529 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
3531 } // ExtKeyUsageSyntax::SetCurrElmt
3534 unsigned long int ExtKeyUsageSyntax::GetCurrElmtIndex()
3536 unsigned long int i
;
3540 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
3549 } // ExtKeyUsageSyntax::GetCurrElmtIndex
3552 // alloc new list elmt, put at end of list
3553 // and return the component type
3554 KeyPurposeId
*ExtKeyUsageSyntax::Append()
3556 AsnListElmt
*newElmt
;
3557 newElmt
= new AsnListElmt
;
3558 newElmt
->elmt
= new KeyPurposeId
;
3559 newElmt
->next
= NULL
;
3562 newElmt
->prev
= NULL
;
3563 first
= last
= newElmt
;
3567 newElmt
->prev
= last
;
3568 last
->next
= newElmt
;
3572 return (curr
= newElmt
)->elmt
;
3573 } // ExtKeyUsageSyntax::Append
3576 // alloc new list elmt, put at begining of list
3577 // and return the component type
3578 KeyPurposeId
*ExtKeyUsageSyntax::Prepend()
3580 AsnListElmt
*newElmt
;
3581 newElmt
= new AsnListElmt
;
3582 newElmt
->elmt
= new KeyPurposeId
;
3583 newElmt
->prev
= NULL
;
3586 newElmt
->next
= NULL
;
3587 first
= last
= newElmt
;
3591 newElmt
->next
= first
;
3592 first
->prev
= newElmt
;
3596 return (curr
= newElmt
)->elmt
;
3597 } // ExtKeyUsageSyntax::Prepend
3600 // alloc new list elmt, insert it before the
3601 // current element and return the component type
3602 // if the current element is null, the new element
3603 // is placed at the beginning of the list.
3604 KeyPurposeId
*ExtKeyUsageSyntax::InsertBefore()
3606 AsnListElmt
*newElmt
;
3607 newElmt
= new AsnListElmt
;
3608 newElmt
->elmt
= new KeyPurposeId
;
3611 newElmt
->next
= first
;
3612 newElmt
->prev
= NULL
;
3619 newElmt
->next
= curr
;
3620 newElmt
->prev
= curr
->prev
;
3621 curr
->prev
= newElmt
;
3625 newElmt
->prev
->next
= newElmt
;
3628 return (curr
= newElmt
)->elmt
;
3629 } // ExtKeyUsageSyntax::InsertBefore
3632 // alloc new list elmt, insert it after the
3633 // current element and return the component type
3634 // if the current element is null, the new element
3635 // is placed at the end of the list.
3636 KeyPurposeId
*ExtKeyUsageSyntax::InsertAfter()
3638 AsnListElmt
*newElmt
;
3639 newElmt
= new AsnListElmt
;
3640 newElmt
->elmt
= new KeyPurposeId
;
3643 newElmt
->prev
= last
;
3644 newElmt
->next
= NULL
;
3651 newElmt
->prev
= curr
;
3652 newElmt
->next
= curr
->next
;
3653 curr
->next
= newElmt
;
3657 newElmt
->next
->prev
= newElmt
;
3660 return (curr
= newElmt
)->elmt
;
3661 } // ExtKeyUsageSyntax::InsertAfter
3664 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::AppendCopy (KeyPurposeId
&elmt
)
3666 AsnListElmt
*newElmt
;
3667 newElmt
= new AsnListElmt
;
3668 newElmt
->elmt
= new KeyPurposeId
;
3669 *newElmt
->elmt
= elmt
;
3670 newElmt
->next
= NULL
;
3673 newElmt
->prev
= NULL
;
3674 first
= last
= newElmt
;
3678 newElmt
->prev
= last
;
3679 last
->next
= newElmt
;
3687 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::PrependCopy (KeyPurposeId
&elmt
)
3689 AsnListElmt
*newElmt
;
3690 newElmt
= new AsnListElmt
;
3691 newElmt
->elmt
= new KeyPurposeId
;
3692 *newElmt
->elmt
= elmt
;
3693 newElmt
->prev
= NULL
;
3696 newElmt
->next
= NULL
;
3697 first
= last
= newElmt
;
3701 newElmt
->next
= first
;
3702 first
->prev
= newElmt
;
3707 } // ExtKeyUsageSyntax::PrependCopy
3710 // alloc new list elmt, insert it before the
3711 // current element, copy the given elmt into the new elmt
3712 // and return the component type.
3713 // if the current element is null, the new element
3714 // is placed at the beginning of the list.
3715 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::InsertBeforeAndCopy (KeyPurposeId
&elmt
)
3717 AsnListElmt
*newElmt
;
3719 newElmt
= new AsnListElmt
;
3720 newElmt
->elmt
= new KeyPurposeId
;
3721 *newElmt
->elmt
= elmt
;
3725 newElmt
->next
= first
;
3726 newElmt
->prev
= NULL
;
3733 newElmt
->next
= curr
;
3734 newElmt
->prev
= curr
->prev
;
3735 curr
->prev
= newElmt
;
3739 newElmt
->prev
->next
= newElmt
;
3743 } // ExtKeyUsageSyntax::InsertBeforeAndCopy
3746 // alloc new list elmt, insert it after the
3747 // current element, copy given elmt in to new elmt
3748 // and return the component type
3749 // if the current element is null, the new element
3750 // is placed at the end of the list.
3751 ExtKeyUsageSyntax
&ExtKeyUsageSyntax::InsertAfterAndCopy (KeyPurposeId
&elmt
)
3753 AsnListElmt
*newElmt
;
3755 newElmt
= new AsnListElmt
;
3756 newElmt
->elmt
= new KeyPurposeId
;
3757 *newElmt
->elmt
= elmt
;
3760 newElmt
->prev
= last
;
3761 newElmt
->next
= NULL
;
3768 newElmt
->prev
= curr
;
3769 newElmt
->next
= curr
->next
;
3770 curr
->next
= newElmt
;
3774 newElmt
->next
->prev
= newElmt
;
3778 } // ExtKeyUsageSyntax::InsertAfterAndCopy
3781 // remove current element from list if current element is not NULL
3782 // The new current element will be the next element.
3783 // If the current element is the last element in the list
3784 // the second but last element will become the new current element.
3785 void ExtKeyUsageSyntax::RemoveCurrFromList()
3787 AsnListElmt
*del_elmt
;
3795 first
= last
= curr
= NULL
;
3796 else if (curr
== first
)
3798 curr
= first
= first
->next
;
3801 else if (curr
== last
)
3803 curr
= last
= last
->prev
;
3808 curr
->prev
->next
= curr
->next
;
3809 curr
->next
->prev
= curr
->prev
;
3812 delete del_elmt
->elmt
;
3818 AsnLen
ExtKeyUsageSyntax::BEncContent (BUF_TYPE b
)
3820 AsnListElmt
*currElmt
;
3822 AsnLen totalLen
= 0;
3823 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
3825 elmtLen
= currElmt
->elmt
->BEncContent (b
);
3826 elmtLen
+= BEncDefLen (b
, elmtLen
);
3828 elmtLen
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
3829 totalLen
+= elmtLen
;
3832 } // ExtKeyUsageSyntax::BEncContent
3835 void ExtKeyUsageSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
3836 AsnLen
&bytesDecoded
, ENV_TYPE env
)
3838 KeyPurposeId
*listElmt
;
3840 AsnLen listBytesDecoded
= 0;
3843 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
3845 tag1
= BDecTag (b
, listBytesDecoded
, env
);
3846 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
3848 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
3851 if ((tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
3853 Asn1Error
<< "Unexpected Tag" << endl
;
3854 SnaccExcep::throwMe(-127);
3857 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
3858 listElmt
= Append();
3859 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
3862 bytesDecoded
+= listBytesDecoded
;
3863 } // ExtKeyUsageSyntax::BDecContent
3866 PrivateKeyUsagePeriod::PrivateKeyUsagePeriod()
3872 PrivateKeyUsagePeriod::PrivateKeyUsagePeriod (const PrivateKeyUsagePeriod
&)
3874 Asn1Error
<< "use of incompletely defined PrivateKeyUsagePeriod::PrivateKeyUsagePeriod (const PrivateKeyUsagePeriod &)" << endl
;
3878 PrivateKeyUsagePeriod::~PrivateKeyUsagePeriod()
3884 AsnType
*PrivateKeyUsagePeriod::Clone() const
3886 return new PrivateKeyUsagePeriod
;
3889 AsnType
*PrivateKeyUsagePeriod::Copy() const
3891 return new PrivateKeyUsagePeriod (*this);
3895 PrivateKeyUsagePeriod
&PrivateKeyUsagePeriod::operator = (const PrivateKeyUsagePeriod
&that
)
3896 #else // SNACC_DEEP_COPY
3897 PrivateKeyUsagePeriod
&PrivateKeyUsagePeriod::operator = (const PrivateKeyUsagePeriod
&)
3898 #endif // SNACC_DEEP_COPY
3906 notBefore
= new GeneralizedTime
;
3907 *notBefore
= *that
.notBefore
;
3917 notAfter
= new GeneralizedTime
;
3918 *notAfter
= *that
.notAfter
;
3928 #else // SNACC_DEEP_COPY
3929 Asn1Error
<< "use of incompletely defined PrivateKeyUsagePeriod &PrivateKeyUsagePeriod::operator = (const PrivateKeyUsagePeriod &)" << endl
;
3931 // if your compiler complains here, check the -novolat option
3932 #endif // SNACC_DEEP_COPY
3936 PrivateKeyUsagePeriod::BEncContent (BUF_TYPE b
)
3938 AsnLen totalLen
= 0;
3941 if (NOT_NULL (notAfter
))
3943 l
= notAfter
->BEncContent (b
);
3944 l
+= BEncDefLen (b
, l
);
3946 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
3950 if (NOT_NULL (notBefore
))
3952 l
= notBefore
->BEncContent (b
);
3953 l
+= BEncDefLen (b
, l
);
3955 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
3960 } // PrivateKeyUsagePeriod::BEncContent
3963 void PrivateKeyUsagePeriod::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
3966 AsnLen seqBytesDecoded
= 0;
3972 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3974 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3976 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
3977 bytesDecoded
+= seqBytesDecoded
;
3982 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
3983 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
3985 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
3986 notBefore
= new GeneralizedTime
;
3987 notBefore
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
3988 if (seqBytesDecoded
== elmtLen0
)
3990 bytesDecoded
+= seqBytesDecoded
;
3995 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
3997 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
3999 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4000 bytesDecoded
+= seqBytesDecoded
;
4006 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1))
4007 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
4009 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4010 notAfter
= new GeneralizedTime
;
4011 notAfter
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4014 bytesDecoded
+= seqBytesDecoded
;
4015 if (elmtLen0
== INDEFINITE_LEN
)
4017 BDecEoc (b
, bytesDecoded
, env
);
4020 else if (seqBytesDecoded
!= elmtLen0
)
4022 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4023 SnaccExcep::throwMe(-128);
4027 } // PrivateKeyUsagePeriod::BDecContent
4029 AsnLen
PrivateKeyUsagePeriod::BEnc (BUF_TYPE b
)
4032 l
= BEncContent (b
);
4033 l
+= BEncConsLen (b
, l
);
4034 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4038 void PrivateKeyUsagePeriod::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4043 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4045 Asn1Error
<< "PrivateKeyUsagePeriod::BDec: ERROR - wrong tag" << endl
;
4046 SnaccExcep::throwMe(-129);
4048 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4049 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4052 void PrivateKeyUsagePeriod::Print (ostream
&os
) const
4055 int nonePrinted
= true;
4056 os
<< "{ -- SEQUENCE --" << endl
;
4057 indentG
+= stdIndentG
;
4059 if (NOT_NULL (notBefore
))
4061 nonePrinted
= false;
4062 Indent (os
, indentG
);
4068 Indent (os
, indentG
);
4074 if (NOT_NULL (notAfter
))
4078 nonePrinted
= false;
4079 Indent (os
, indentG
);
4085 Indent (os
, indentG
);
4092 indentG
-= stdIndentG
;
4093 Indent (os
, indentG
);
4096 } // PrivateKeyUsagePeriod::Print
4099 AsnType
*PolicyMappingsSyntax::Clone() const
4101 return new PolicyMappingsSyntax
;
4104 AsnType
*PolicyMappingsSyntax::Copy() const
4106 return new PolicyMappingsSyntax (*this);
4109 AsnLen
PolicyMappingsSyntax::BEnc (BUF_TYPE b
)
4112 l
= BEncContent (b
);
4113 l
+= BEncConsLen (b
, l
);
4114 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4118 void PolicyMappingsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4123 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4125 Asn1Error
<< "PolicyMappingsSyntax::BDec: ERROR - wrong tag" << endl
;
4126 SnaccExcep::throwMe(-130);
4128 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4129 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4132 PolicyMappingsSyntax::PolicyMappingsSyntax (const PolicyMappingsSyntax
&)
4134 Asn1Error
<< "use of incompletely defined PolicyMappingsSyntax::PolicyMappingsSyntax (const PolicyMappingsSyntax &)" << endl
;
4138 PolicyMappingsSyntax::~PolicyMappingsSyntax()
4141 for (; Curr() != NULL
; RemoveCurrFromList())
4143 } // end of destructor
4146 PolicyMappingsSyntax
&PolicyMappingsSyntax::operator = (const PolicyMappingsSyntax
&that
)
4147 #else // SNACC_DEEP_COPY
4148 PolicyMappingsSyntax
&PolicyMappingsSyntax::operator = (const PolicyMappingsSyntax
&)
4149 #endif // SNACC_DEEP_COPY
4155 for (; Curr(); RemoveCurrFromList())
4158 //that.SetCurrToFirst();
4159 //for (; that.Curr(); that.GoNext())
4160 // AppendCopy (*that.Curr());
4161 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
4162 AppendCopy (*run
->elmt
);
4166 #else // SNACC_DEEP_COPY
4167 Asn1Error
<< "use of incompletely defined PolicyMappingsSyntax &PolicyMappingsSyntax::operator = (const PolicyMappingsSyntax &)" << endl
;
4169 // if your compiler complains here, check the -novolat option
4170 #endif // SNACC_DEEP_COPY
4173 void PolicyMappingsSyntax::Print (ostream
&os
) const
4176 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
4177 indentG
+= stdIndentG
;
4179 //for (; Curr() != NULL; GoNext())
4180 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
4182 Indent (os
, indentG
);
4185 //if (Curr() != Last())
4190 indentG
-= stdIndentG
;
4191 Indent (os
, indentG
);
4199 void PolicyMappingsSyntax::SetCurrElmt (unsigned long int index
)
4201 unsigned long int i
;
4204 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
4206 } // PolicyMappingsSyntax::SetCurrElmt
4209 unsigned long int PolicyMappingsSyntax::GetCurrElmtIndex()
4211 unsigned long int i
;
4215 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
4224 } // PolicyMappingsSyntax::GetCurrElmtIndex
4227 // alloc new list elmt, put at end of list
4228 // and return the component type
4229 PolicyMappingsSyntaxSeq
*PolicyMappingsSyntax::Append()
4231 AsnListElmt
*newElmt
;
4232 newElmt
= new AsnListElmt
;
4233 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4234 newElmt
->next
= NULL
;
4237 newElmt
->prev
= NULL
;
4238 first
= last
= newElmt
;
4242 newElmt
->prev
= last
;
4243 last
->next
= newElmt
;
4247 return (curr
= newElmt
)->elmt
;
4248 } // PolicyMappingsSyntax::Append
4251 // alloc new list elmt, put at begining of list
4252 // and return the component type
4253 PolicyMappingsSyntaxSeq
*PolicyMappingsSyntax::Prepend()
4255 AsnListElmt
*newElmt
;
4256 newElmt
= new AsnListElmt
;
4257 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4258 newElmt
->prev
= NULL
;
4261 newElmt
->next
= NULL
;
4262 first
= last
= newElmt
;
4266 newElmt
->next
= first
;
4267 first
->prev
= newElmt
;
4271 return (curr
= newElmt
)->elmt
;
4272 } // PolicyMappingsSyntax::Prepend
4275 // alloc new list elmt, insert it before the
4276 // current element and return the component type
4277 // if the current element is null, the new element
4278 // is placed at the beginning of the list.
4279 PolicyMappingsSyntaxSeq
*PolicyMappingsSyntax::InsertBefore()
4281 AsnListElmt
*newElmt
;
4282 newElmt
= new AsnListElmt
;
4283 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4286 newElmt
->next
= first
;
4287 newElmt
->prev
= NULL
;
4294 newElmt
->next
= curr
;
4295 newElmt
->prev
= curr
->prev
;
4296 curr
->prev
= newElmt
;
4300 newElmt
->prev
->next
= newElmt
;
4303 return (curr
= newElmt
)->elmt
;
4304 } // PolicyMappingsSyntax::InsertBefore
4307 // alloc new list elmt, insert it after the
4308 // current element and return the component type
4309 // if the current element is null, the new element
4310 // is placed at the end of the list.
4311 PolicyMappingsSyntaxSeq
*PolicyMappingsSyntax::InsertAfter()
4313 AsnListElmt
*newElmt
;
4314 newElmt
= new AsnListElmt
;
4315 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4318 newElmt
->prev
= last
;
4319 newElmt
->next
= NULL
;
4326 newElmt
->prev
= curr
;
4327 newElmt
->next
= curr
->next
;
4328 curr
->next
= newElmt
;
4332 newElmt
->next
->prev
= newElmt
;
4335 return (curr
= newElmt
)->elmt
;
4336 } // PolicyMappingsSyntax::InsertAfter
4339 PolicyMappingsSyntax
&PolicyMappingsSyntax::AppendCopy (PolicyMappingsSyntaxSeq
&elmt
)
4341 AsnListElmt
*newElmt
;
4342 newElmt
= new AsnListElmt
;
4343 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4344 *newElmt
->elmt
= elmt
;
4345 newElmt
->next
= NULL
;
4348 newElmt
->prev
= NULL
;
4349 first
= last
= newElmt
;
4353 newElmt
->prev
= last
;
4354 last
->next
= newElmt
;
4362 PolicyMappingsSyntax
&PolicyMappingsSyntax::PrependCopy (PolicyMappingsSyntaxSeq
&elmt
)
4364 AsnListElmt
*newElmt
;
4365 newElmt
= new AsnListElmt
;
4366 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4367 *newElmt
->elmt
= elmt
;
4368 newElmt
->prev
= NULL
;
4371 newElmt
->next
= NULL
;
4372 first
= last
= newElmt
;
4376 newElmt
->next
= first
;
4377 first
->prev
= newElmt
;
4382 } // PolicyMappingsSyntax::PrependCopy
4385 // alloc new list elmt, insert it before the
4386 // current element, copy the given elmt into the new elmt
4387 // and return the component type.
4388 // if the current element is null, the new element
4389 // is placed at the beginning of the list.
4390 PolicyMappingsSyntax
&PolicyMappingsSyntax::InsertBeforeAndCopy (PolicyMappingsSyntaxSeq
&elmt
)
4392 AsnListElmt
*newElmt
;
4394 newElmt
= new AsnListElmt
;
4395 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4396 *newElmt
->elmt
= elmt
;
4400 newElmt
->next
= first
;
4401 newElmt
->prev
= NULL
;
4408 newElmt
->next
= curr
;
4409 newElmt
->prev
= curr
->prev
;
4410 curr
->prev
= newElmt
;
4414 newElmt
->prev
->next
= newElmt
;
4418 } // PolicyMappingsSyntax::InsertBeforeAndCopy
4421 // alloc new list elmt, insert it after the
4422 // current element, copy given elmt in to new elmt
4423 // and return the component type
4424 // if the current element is null, the new element
4425 // is placed at the end of the list.
4426 PolicyMappingsSyntax
&PolicyMappingsSyntax::InsertAfterAndCopy (PolicyMappingsSyntaxSeq
&elmt
)
4428 AsnListElmt
*newElmt
;
4430 newElmt
= new AsnListElmt
;
4431 newElmt
->elmt
= new PolicyMappingsSyntaxSeq
;
4432 *newElmt
->elmt
= elmt
;
4435 newElmt
->prev
= last
;
4436 newElmt
->next
= NULL
;
4443 newElmt
->prev
= curr
;
4444 newElmt
->next
= curr
->next
;
4445 curr
->next
= newElmt
;
4449 newElmt
->next
->prev
= newElmt
;
4453 } // PolicyMappingsSyntax::InsertAfterAndCopy
4456 // remove current element from list if current element is not NULL
4457 // The new current element will be the next element.
4458 // If the current element is the last element in the list
4459 // the second but last element will become the new current element.
4460 void PolicyMappingsSyntax::RemoveCurrFromList()
4462 AsnListElmt
*del_elmt
;
4470 first
= last
= curr
= NULL
;
4471 else if (curr
== first
)
4473 curr
= first
= first
->next
;
4476 else if (curr
== last
)
4478 curr
= last
= last
->prev
;
4483 curr
->prev
->next
= curr
->next
;
4484 curr
->next
->prev
= curr
->prev
;
4487 delete del_elmt
->elmt
;
4493 AsnLen
PolicyMappingsSyntax::BEncContent (BUF_TYPE b
)
4495 AsnListElmt
*currElmt
;
4497 AsnLen totalLen
= 0;
4498 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
4501 elmtLen
= currElmt
->elmt
->BEncContent (b
);
4502 elmtLen
+= BEncConsLen (b
, elmtLen
);
4504 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4505 totalLen
+= elmtLen
;
4508 } // PolicyMappingsSyntax::BEncContent
4511 void PolicyMappingsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
4512 AsnLen
&bytesDecoded
, ENV_TYPE env
)
4514 PolicyMappingsSyntaxSeq
*listElmt
;
4516 AsnLen listBytesDecoded
= 0;
4519 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
4521 tag1
= BDecTag (b
, listBytesDecoded
, env
);
4522 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
4524 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
4527 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4529 Asn1Error
<< "Unexpected Tag" << endl
;
4530 SnaccExcep::throwMe(-131);
4533 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
4534 listElmt
= Append();
4535 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
4538 bytesDecoded
+= listBytesDecoded
;
4539 } // PolicyMappingsSyntax::BDecContent
4542 SupportedAlgorithm::SupportedAlgorithm()
4545 algorithmIdentifier
= new AlgorithmIdentifier
;
4547 algorithmIdentifier
= NULL
; // incomplete initialization of mandatory element!
4549 intendedUsage
= NULL
;
4550 intendedCertificatePolicies
= NULL
;
4553 SupportedAlgorithm::SupportedAlgorithm (const SupportedAlgorithm
&)
4555 Asn1Error
<< "use of incompletely defined SupportedAlgorithm::SupportedAlgorithm (const SupportedAlgorithm &)" << endl
;
4559 SupportedAlgorithm::~SupportedAlgorithm()
4561 delete algorithmIdentifier
;
4562 delete intendedUsage
;
4563 delete intendedCertificatePolicies
;
4566 AsnType
*SupportedAlgorithm::Clone() const
4568 return new SupportedAlgorithm
;
4571 AsnType
*SupportedAlgorithm::Copy() const
4573 return new SupportedAlgorithm (*this);
4577 SupportedAlgorithm
&SupportedAlgorithm::operator = (const SupportedAlgorithm
&that
)
4578 #else // SNACC_DEEP_COPY
4579 SupportedAlgorithm
&SupportedAlgorithm::operator = (const SupportedAlgorithm
&)
4580 #endif // SNACC_DEEP_COPY
4585 if (that
.algorithmIdentifier
)
4587 if (!algorithmIdentifier
)
4588 algorithmIdentifier
= new AlgorithmIdentifier
;
4589 *algorithmIdentifier
= *that
.algorithmIdentifier
;
4593 delete algorithmIdentifier
;
4594 algorithmIdentifier
= NULL
;
4596 if (that
.intendedUsage
)
4599 intendedUsage
= new KeyUsage
;
4600 *intendedUsage
= *that
.intendedUsage
;
4604 delete intendedUsage
;
4605 intendedUsage
= NULL
;
4607 if (that
.intendedCertificatePolicies
)
4609 if (!intendedCertificatePolicies
)
4610 intendedCertificatePolicies
= new CertificatePoliciesSyntax
;
4611 *intendedCertificatePolicies
= *that
.intendedCertificatePolicies
;
4615 delete intendedCertificatePolicies
;
4616 intendedCertificatePolicies
= NULL
;
4621 #else // SNACC_DEEP_COPY
4622 Asn1Error
<< "use of incompletely defined SupportedAlgorithm &SupportedAlgorithm::operator = (const SupportedAlgorithm &)" << endl
;
4624 // if your compiler complains here, check the -novolat option
4625 #endif // SNACC_DEEP_COPY
4629 SupportedAlgorithm::BEncContent (BUF_TYPE b
)
4631 AsnLen totalLen
= 0;
4634 if (NOT_NULL (intendedCertificatePolicies
))
4637 l
= intendedCertificatePolicies
->BEncContent (b
);
4638 l
+= BEncConsLen (b
, l
);
4640 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
4644 if (NOT_NULL (intendedUsage
))
4646 l
= intendedUsage
->BEncContent (b
);
4647 l
+= BEncDefLen (b
, l
);
4649 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
4654 l
= algorithmIdentifier
->BEncContent (b
);
4655 l
+= BEncConsLen (b
, l
);
4657 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4661 } // SupportedAlgorithm::BEncContent
4664 void SupportedAlgorithm::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4667 AsnLen seqBytesDecoded
= 0;
4669 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4671 if ((tag1
== MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
4673 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4674 algorithmIdentifier
= new AlgorithmIdentifier
;
4675 algorithmIdentifier
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4676 if (seqBytesDecoded
== elmtLen0
)
4678 bytesDecoded
+= seqBytesDecoded
;
4683 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4685 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4687 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4688 bytesDecoded
+= seqBytesDecoded
;
4695 Asn1Error
<< "ERROR - SEQUENCE is missing non-optional elmt." << endl
;
4696 SnaccExcep::throwMe(-132);
4699 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0))
4700 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
4702 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4703 intendedUsage
= new KeyUsage
;
4704 intendedUsage
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4705 if (seqBytesDecoded
== elmtLen0
)
4707 bytesDecoded
+= seqBytesDecoded
;
4712 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4714 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4716 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4717 bytesDecoded
+= seqBytesDecoded
;
4723 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
4725 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4726 intendedCertificatePolicies
= new CertificatePoliciesSyntax
;
4727 intendedCertificatePolicies
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4730 bytesDecoded
+= seqBytesDecoded
;
4731 if (elmtLen0
== INDEFINITE_LEN
)
4733 BDecEoc (b
, bytesDecoded
, env
);
4736 else if (seqBytesDecoded
!= elmtLen0
)
4738 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4739 SnaccExcep::throwMe(-133);
4743 } // SupportedAlgorithm::BDecContent
4745 AsnLen
SupportedAlgorithm::BEnc (BUF_TYPE b
)
4748 l
= BEncContent (b
);
4749 l
+= BEncConsLen (b
, l
);
4750 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4754 void SupportedAlgorithm::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4759 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
4761 Asn1Error
<< "SupportedAlgorithm::BDec: ERROR - wrong tag" << endl
;
4762 SnaccExcep::throwMe(-134);
4764 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
4765 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
4768 void SupportedAlgorithm::Print (ostream
&os
) const
4771 os
<< "{ -- SEQUENCE --" << endl
;
4772 indentG
+= stdIndentG
;
4774 if (NOT_NULL (algorithmIdentifier
))
4776 Indent (os
, indentG
);
4777 os
<< "algorithmIdentifier ";
4778 os
<< *algorithmIdentifier
;
4782 Indent (os
, indentG
);
4783 os
<< "algorithmIdentifier ";
4788 if (NOT_NULL (intendedUsage
))
4791 Indent (os
, indentG
);
4792 os
<< "intendedUsage ";
4793 os
<< *intendedUsage
;
4797 Indent (os
, indentG
);
4798 os
<< "intendedUsage ";
4803 if (NOT_NULL (intendedCertificatePolicies
))
4806 Indent (os
, indentG
);
4807 os
<< "intendedCertificatePolicies ";
4808 os
<< *intendedCertificatePolicies
;
4812 Indent (os
, indentG
);
4813 os
<< "intendedCertificatePolicies ";
4819 indentG
-= stdIndentG
;
4820 Indent (os
, indentG
);
4823 } // SupportedAlgorithm::Print
4826 BasicConstraintsSyntax::BasicConstraintsSyntax()
4829 pathLenConstraint
= NULL
;
4832 BasicConstraintsSyntax::BasicConstraintsSyntax (const BasicConstraintsSyntax
&)
4834 Asn1Error
<< "use of incompletely defined BasicConstraintsSyntax::BasicConstraintsSyntax (const BasicConstraintsSyntax &)" << endl
;
4838 BasicConstraintsSyntax::~BasicConstraintsSyntax()
4841 delete pathLenConstraint
;
4844 AsnType
*BasicConstraintsSyntax::Clone() const
4846 return new BasicConstraintsSyntax
;
4849 AsnType
*BasicConstraintsSyntax::Copy() const
4851 return new BasicConstraintsSyntax (*this);
4855 BasicConstraintsSyntax
&BasicConstraintsSyntax::operator = (const BasicConstraintsSyntax
&that
)
4856 #else // SNACC_DEEP_COPY
4857 BasicConstraintsSyntax
&BasicConstraintsSyntax::operator = (const BasicConstraintsSyntax
&)
4858 #endif // SNACC_DEEP_COPY
4874 if (that
.pathLenConstraint
)
4876 if (!pathLenConstraint
)
4877 pathLenConstraint
= new AsnInt
;
4878 *pathLenConstraint
= *that
.pathLenConstraint
;
4882 delete pathLenConstraint
;
4883 pathLenConstraint
= NULL
;
4888 #else // SNACC_DEEP_COPY
4889 Asn1Error
<< "use of incompletely defined BasicConstraintsSyntax &BasicConstraintsSyntax::operator = (const BasicConstraintsSyntax &)" << endl
;
4891 // if your compiler complains here, check the -novolat option
4892 #endif // SNACC_DEEP_COPY
4896 BasicConstraintsSyntax::BEncContent (BUF_TYPE b
)
4898 AsnLen totalLen
= 0;
4901 if (NOT_NULL (pathLenConstraint
))
4903 l
= pathLenConstraint
->BEncContent (b
);
4904 BEncDefLenTo127 (b
, l
);
4907 l
+= BEncTag1 (b
, UNIV
, PRIM
, INTEGER_TAG_CODE
);
4913 l
= cA
->BEncContent (b
);
4914 BEncDefLenTo127 (b
, l
);
4917 l
+= BEncTag1 (b
, UNIV
, PRIM
, BOOLEAN_TAG_CODE
);
4922 } // BasicConstraintsSyntax::BEncContent
4925 void BasicConstraintsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
4928 AsnLen seqBytesDecoded
= 0;
4934 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4936 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4938 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4939 bytesDecoded
+= seqBytesDecoded
;
4944 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, BOOLEAN_TAG_CODE
)))
4946 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4948 cA
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4949 if (seqBytesDecoded
== elmtLen0
)
4951 bytesDecoded
+= seqBytesDecoded
;
4956 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
4958 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
4960 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
4961 bytesDecoded
+= seqBytesDecoded
;
4967 if ((tag1
== MAKE_TAG_ID (UNIV
, PRIM
, INTEGER_TAG_CODE
)))
4969 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
4970 pathLenConstraint
= new AsnInt
;
4971 pathLenConstraint
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
4974 bytesDecoded
+= seqBytesDecoded
;
4975 if (elmtLen0
== INDEFINITE_LEN
)
4977 BDecEoc (b
, bytesDecoded
, env
);
4980 else if (seqBytesDecoded
!= elmtLen0
)
4982 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
4983 SnaccExcep::throwMe(-135);
4987 } // BasicConstraintsSyntax::BDecContent
4989 AsnLen
BasicConstraintsSyntax::BEnc (BUF_TYPE b
)
4992 l
= BEncContent (b
);
4993 l
+= BEncConsLen (b
, l
);
4994 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
4998 void BasicConstraintsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5003 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5005 Asn1Error
<< "BasicConstraintsSyntax::BDec: ERROR - wrong tag" << endl
;
5006 SnaccExcep::throwMe(-136);
5008 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5009 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5012 void BasicConstraintsSyntax::Print (ostream
&os
) const
5015 int nonePrinted
= true;
5016 os
<< "{ -- SEQUENCE --" << endl
;
5017 indentG
+= stdIndentG
;
5021 nonePrinted
= false;
5022 Indent (os
, indentG
);
5028 Indent (os
, indentG
);
5034 if (NOT_NULL (pathLenConstraint
))
5038 nonePrinted
= false;
5039 Indent (os
, indentG
);
5040 os
<< "pathLenConstraint ";
5041 os
<< *pathLenConstraint
;
5045 Indent (os
, indentG
);
5046 os
<< "pathLenConstraint ";
5052 indentG
-= stdIndentG
;
5053 Indent (os
, indentG
);
5056 } // BasicConstraintsSyntax::Print
5059 NameConstraintsSyntax::NameConstraintsSyntax()
5061 permittedSubtrees
= NULL
;
5062 excludedSubtrees
= NULL
;
5065 NameConstraintsSyntax::NameConstraintsSyntax (const NameConstraintsSyntax
&)
5067 Asn1Error
<< "use of incompletely defined NameConstraintsSyntax::NameConstraintsSyntax (const NameConstraintsSyntax &)" << endl
;
5071 NameConstraintsSyntax::~NameConstraintsSyntax()
5073 delete permittedSubtrees
;
5074 delete excludedSubtrees
;
5077 AsnType
*NameConstraintsSyntax::Clone() const
5079 return new NameConstraintsSyntax
;
5082 AsnType
*NameConstraintsSyntax::Copy() const
5084 return new NameConstraintsSyntax (*this);
5088 NameConstraintsSyntax
&NameConstraintsSyntax::operator = (const NameConstraintsSyntax
&that
)
5089 #else // SNACC_DEEP_COPY
5090 NameConstraintsSyntax
&NameConstraintsSyntax::operator = (const NameConstraintsSyntax
&)
5091 #endif // SNACC_DEEP_COPY
5096 if (that
.permittedSubtrees
)
5098 if (!permittedSubtrees
)
5099 permittedSubtrees
= new GeneralSubtrees
;
5100 *permittedSubtrees
= *that
.permittedSubtrees
;
5104 delete permittedSubtrees
;
5105 permittedSubtrees
= NULL
;
5107 if (that
.excludedSubtrees
)
5109 if (!excludedSubtrees
)
5110 excludedSubtrees
= new GeneralSubtrees
;
5111 *excludedSubtrees
= *that
.excludedSubtrees
;
5115 delete excludedSubtrees
;
5116 excludedSubtrees
= NULL
;
5121 #else // SNACC_DEEP_COPY
5122 Asn1Error
<< "use of incompletely defined NameConstraintsSyntax &NameConstraintsSyntax::operator = (const NameConstraintsSyntax &)" << endl
;
5124 // if your compiler complains here, check the -novolat option
5125 #endif // SNACC_DEEP_COPY
5129 NameConstraintsSyntax::BEncContent (BUF_TYPE b
)
5131 AsnLen totalLen
= 0;
5134 if (NOT_NULL (excludedSubtrees
))
5137 l
= excludedSubtrees
->BEncContent (b
);
5138 l
+= BEncConsLen (b
, l
);
5140 l
+= BEncTag1 (b
, CNTX
, CONS
, 1);
5144 if (NOT_NULL (permittedSubtrees
))
5147 l
= permittedSubtrees
->BEncContent (b
);
5148 l
+= BEncConsLen (b
, l
);
5150 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
5155 } // NameConstraintsSyntax::BEncContent
5158 void NameConstraintsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5161 AsnLen seqBytesDecoded
= 0;
5167 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5169 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5171 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5172 bytesDecoded
+= seqBytesDecoded
;
5177 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
5179 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5180 permittedSubtrees
= new GeneralSubtrees
;
5181 permittedSubtrees
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5182 if (seqBytesDecoded
== elmtLen0
)
5184 bytesDecoded
+= seqBytesDecoded
;
5189 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5191 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5193 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5194 bytesDecoded
+= seqBytesDecoded
;
5200 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 1)))
5202 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5203 excludedSubtrees
= new GeneralSubtrees
;
5204 excludedSubtrees
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5207 bytesDecoded
+= seqBytesDecoded
;
5208 if (elmtLen0
== INDEFINITE_LEN
)
5210 BDecEoc (b
, bytesDecoded
, env
);
5213 else if (seqBytesDecoded
!= elmtLen0
)
5215 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5216 SnaccExcep::throwMe(-137);
5220 } // NameConstraintsSyntax::BDecContent
5222 AsnLen
NameConstraintsSyntax::BEnc (BUF_TYPE b
)
5225 l
= BEncContent (b
);
5226 l
+= BEncConsLen (b
, l
);
5227 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5231 void NameConstraintsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5236 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5238 Asn1Error
<< "NameConstraintsSyntax::BDec: ERROR - wrong tag" << endl
;
5239 SnaccExcep::throwMe(-138);
5241 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5242 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5245 void NameConstraintsSyntax::Print (ostream
&os
) const
5248 int nonePrinted
= true;
5249 os
<< "{ -- SEQUENCE --" << endl
;
5250 indentG
+= stdIndentG
;
5252 if (NOT_NULL (permittedSubtrees
))
5254 nonePrinted
= false;
5255 Indent (os
, indentG
);
5256 os
<< "permittedSubtrees ";
5257 os
<< *permittedSubtrees
;
5261 Indent (os
, indentG
);
5262 os
<< "permittedSubtrees ";
5267 if (NOT_NULL (excludedSubtrees
))
5271 nonePrinted
= false;
5272 Indent (os
, indentG
);
5273 os
<< "excludedSubtrees ";
5274 os
<< *excludedSubtrees
;
5278 Indent (os
, indentG
);
5279 os
<< "excludedSubtrees ";
5285 indentG
-= stdIndentG
;
5286 Indent (os
, indentG
);
5289 } // NameConstraintsSyntax::Print
5292 PolicyConstraintsSyntax::PolicyConstraintsSyntax()
5294 requireExplicitPolicy
= NULL
;
5295 inhibitPolicyMapping
= NULL
;
5298 PolicyConstraintsSyntax::PolicyConstraintsSyntax (const PolicyConstraintsSyntax
&)
5300 Asn1Error
<< "use of incompletely defined PolicyConstraintsSyntax::PolicyConstraintsSyntax (const PolicyConstraintsSyntax &)" << endl
;
5304 PolicyConstraintsSyntax::~PolicyConstraintsSyntax()
5306 delete requireExplicitPolicy
;
5307 delete inhibitPolicyMapping
;
5310 AsnType
*PolicyConstraintsSyntax::Clone() const
5312 return new PolicyConstraintsSyntax
;
5315 AsnType
*PolicyConstraintsSyntax::Copy() const
5317 return new PolicyConstraintsSyntax (*this);
5321 PolicyConstraintsSyntax
&PolicyConstraintsSyntax::operator = (const PolicyConstraintsSyntax
&that
)
5322 #else // SNACC_DEEP_COPY
5323 PolicyConstraintsSyntax
&PolicyConstraintsSyntax::operator = (const PolicyConstraintsSyntax
&)
5324 #endif // SNACC_DEEP_COPY
5329 if (that
.requireExplicitPolicy
)
5331 if (!requireExplicitPolicy
)
5332 requireExplicitPolicy
= new SkipCerts
;
5333 *requireExplicitPolicy
= *that
.requireExplicitPolicy
;
5337 delete requireExplicitPolicy
;
5338 requireExplicitPolicy
= NULL
;
5340 if (that
.inhibitPolicyMapping
)
5342 if (!inhibitPolicyMapping
)
5343 inhibitPolicyMapping
= new SkipCerts
;
5344 *inhibitPolicyMapping
= *that
.inhibitPolicyMapping
;
5348 delete inhibitPolicyMapping
;
5349 inhibitPolicyMapping
= NULL
;
5354 #else // SNACC_DEEP_COPY
5355 Asn1Error
<< "use of incompletely defined PolicyConstraintsSyntax &PolicyConstraintsSyntax::operator = (const PolicyConstraintsSyntax &)" << endl
;
5357 // if your compiler complains here, check the -novolat option
5358 #endif // SNACC_DEEP_COPY
5362 PolicyConstraintsSyntax::BEncContent (BUF_TYPE b
)
5364 AsnLen totalLen
= 0;
5367 if (NOT_NULL (inhibitPolicyMapping
))
5369 l
= inhibitPolicyMapping
->BEncContent (b
);
5370 BEncDefLenTo127 (b
, l
);
5373 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
5377 if (NOT_NULL (requireExplicitPolicy
))
5379 l
= requireExplicitPolicy
->BEncContent (b
);
5380 BEncDefLenTo127 (b
, l
);
5383 l
+= BEncTag1 (b
, CNTX
, PRIM
, 0);
5388 } // PolicyConstraintsSyntax::BEncContent
5391 void PolicyConstraintsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5394 AsnLen seqBytesDecoded
= 0;
5400 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5402 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5404 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5405 bytesDecoded
+= seqBytesDecoded
;
5410 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 0)))
5412 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5413 requireExplicitPolicy
= new SkipCerts
;
5414 requireExplicitPolicy
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5415 if (seqBytesDecoded
== elmtLen0
)
5417 bytesDecoded
+= seqBytesDecoded
;
5422 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
5424 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
5426 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
5427 bytesDecoded
+= seqBytesDecoded
;
5433 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1)))
5435 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
5436 inhibitPolicyMapping
= new SkipCerts
;
5437 inhibitPolicyMapping
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
5440 bytesDecoded
+= seqBytesDecoded
;
5441 if (elmtLen0
== INDEFINITE_LEN
)
5443 BDecEoc (b
, bytesDecoded
, env
);
5446 else if (seqBytesDecoded
!= elmtLen0
)
5448 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
5449 SnaccExcep::throwMe(-139);
5453 } // PolicyConstraintsSyntax::BDecContent
5455 AsnLen
PolicyConstraintsSyntax::BEnc (BUF_TYPE b
)
5458 l
= BEncContent (b
);
5459 l
+= BEncConsLen (b
, l
);
5460 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5464 void PolicyConstraintsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5469 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5471 Asn1Error
<< "PolicyConstraintsSyntax::BDec: ERROR - wrong tag" << endl
;
5472 SnaccExcep::throwMe(-140);
5474 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5475 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5478 void PolicyConstraintsSyntax::Print (ostream
&os
) const
5481 int nonePrinted
= true;
5482 os
<< "{ -- SEQUENCE --" << endl
;
5483 indentG
+= stdIndentG
;
5485 if (NOT_NULL (requireExplicitPolicy
))
5487 nonePrinted
= false;
5488 Indent (os
, indentG
);
5489 os
<< "requireExplicitPolicy ";
5490 os
<< *requireExplicitPolicy
;
5494 Indent (os
, indentG
);
5495 os
<< "requireExplicitPolicy ";
5500 if (NOT_NULL (inhibitPolicyMapping
))
5504 nonePrinted
= false;
5505 Indent (os
, indentG
);
5506 os
<< "inhibitPolicyMapping ";
5507 os
<< *inhibitPolicyMapping
;
5511 Indent (os
, indentG
);
5512 os
<< "inhibitPolicyMapping ";
5518 indentG
-= stdIndentG
;
5519 Indent (os
, indentG
);
5522 } // PolicyConstraintsSyntax::Print
5525 AsnType
*CertPolicySet::Clone() const
5527 return new CertPolicySet
;
5530 AsnType
*CertPolicySet::Copy() const
5532 return new CertPolicySet (*this);
5535 AsnLen
CertPolicySet::BEnc (BUF_TYPE b
)
5538 l
= BEncContent (b
);
5539 l
+= BEncConsLen (b
, l
);
5540 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5544 void CertPolicySet::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5549 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5551 Asn1Error
<< "CertPolicySet::BDec: ERROR - wrong tag" << endl
;
5552 SnaccExcep::throwMe(-141);
5554 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5555 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
5558 CertPolicySet::CertPolicySet (const CertPolicySet
&)
5560 Asn1Error
<< "use of incompletely defined CertPolicySet::CertPolicySet (const CertPolicySet &)" << endl
;
5564 CertPolicySet::~CertPolicySet()
5567 for (; Curr() != NULL
; RemoveCurrFromList())
5569 } // end of destructor
5572 CertPolicySet
&CertPolicySet::operator = (const CertPolicySet
&that
)
5573 #else // SNACC_DEEP_COPY
5574 CertPolicySet
&CertPolicySet::operator = (const CertPolicySet
&)
5575 #endif // SNACC_DEEP_COPY
5581 for (; Curr(); RemoveCurrFromList())
5584 //that.SetCurrToFirst();
5585 //for (; that.Curr(); that.GoNext())
5586 // AppendCopy (*that.Curr());
5587 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
5588 AppendCopy (*run
->elmt
);
5592 #else // SNACC_DEEP_COPY
5593 Asn1Error
<< "use of incompletely defined CertPolicySet &CertPolicySet::operator = (const CertPolicySet &)" << endl
;
5595 // if your compiler complains here, check the -novolat option
5596 #endif // SNACC_DEEP_COPY
5599 void CertPolicySet::Print (ostream
&os
) const
5602 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
5603 indentG
+= stdIndentG
;
5605 //for (; Curr() != NULL; GoNext())
5606 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
5608 Indent (os
, indentG
);
5611 //if (Curr() != Last())
5616 indentG
-= stdIndentG
;
5617 Indent (os
, indentG
);
5625 void CertPolicySet::SetCurrElmt (unsigned long int index
)
5627 unsigned long int i
;
5630 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
5632 } // CertPolicySet::SetCurrElmt
5635 unsigned long int CertPolicySet::GetCurrElmtIndex()
5637 unsigned long int i
;
5641 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
5650 } // CertPolicySet::GetCurrElmtIndex
5653 // alloc new list elmt, put at end of list
5654 // and return the component type
5655 CertPolicyId
*CertPolicySet::Append()
5657 AsnListElmt
*newElmt
;
5658 newElmt
= new AsnListElmt
;
5659 newElmt
->elmt
= new CertPolicyId
;
5660 newElmt
->next
= NULL
;
5663 newElmt
->prev
= NULL
;
5664 first
= last
= newElmt
;
5668 newElmt
->prev
= last
;
5669 last
->next
= newElmt
;
5673 return (curr
= newElmt
)->elmt
;
5674 } // CertPolicySet::Append
5677 // alloc new list elmt, put at begining of list
5678 // and return the component type
5679 CertPolicyId
*CertPolicySet::Prepend()
5681 AsnListElmt
*newElmt
;
5682 newElmt
= new AsnListElmt
;
5683 newElmt
->elmt
= new CertPolicyId
;
5684 newElmt
->prev
= NULL
;
5687 newElmt
->next
= NULL
;
5688 first
= last
= newElmt
;
5692 newElmt
->next
= first
;
5693 first
->prev
= newElmt
;
5697 return (curr
= newElmt
)->elmt
;
5698 } // CertPolicySet::Prepend
5701 // alloc new list elmt, insert it before the
5702 // current element and return the component type
5703 // if the current element is null, the new element
5704 // is placed at the beginning of the list.
5705 CertPolicyId
*CertPolicySet::InsertBefore()
5707 AsnListElmt
*newElmt
;
5708 newElmt
= new AsnListElmt
;
5709 newElmt
->elmt
= new CertPolicyId
;
5712 newElmt
->next
= first
;
5713 newElmt
->prev
= NULL
;
5720 newElmt
->next
= curr
;
5721 newElmt
->prev
= curr
->prev
;
5722 curr
->prev
= newElmt
;
5726 newElmt
->prev
->next
= newElmt
;
5729 return (curr
= newElmt
)->elmt
;
5730 } // CertPolicySet::InsertBefore
5733 // alloc new list elmt, insert it after the
5734 // current element and return the component type
5735 // if the current element is null, the new element
5736 // is placed at the end of the list.
5737 CertPolicyId
*CertPolicySet::InsertAfter()
5739 AsnListElmt
*newElmt
;
5740 newElmt
= new AsnListElmt
;
5741 newElmt
->elmt
= new CertPolicyId
;
5744 newElmt
->prev
= last
;
5745 newElmt
->next
= NULL
;
5752 newElmt
->prev
= curr
;
5753 newElmt
->next
= curr
->next
;
5754 curr
->next
= newElmt
;
5758 newElmt
->next
->prev
= newElmt
;
5761 return (curr
= newElmt
)->elmt
;
5762 } // CertPolicySet::InsertAfter
5765 CertPolicySet
&CertPolicySet::AppendCopy (CertPolicyId
&elmt
)
5767 AsnListElmt
*newElmt
;
5768 newElmt
= new AsnListElmt
;
5769 newElmt
->elmt
= new CertPolicyId
;
5770 *newElmt
->elmt
= elmt
;
5771 newElmt
->next
= NULL
;
5774 newElmt
->prev
= NULL
;
5775 first
= last
= newElmt
;
5779 newElmt
->prev
= last
;
5780 last
->next
= newElmt
;
5788 CertPolicySet
&CertPolicySet::PrependCopy (CertPolicyId
&elmt
)
5790 AsnListElmt
*newElmt
;
5791 newElmt
= new AsnListElmt
;
5792 newElmt
->elmt
= new CertPolicyId
;
5793 *newElmt
->elmt
= elmt
;
5794 newElmt
->prev
= NULL
;
5797 newElmt
->next
= NULL
;
5798 first
= last
= newElmt
;
5802 newElmt
->next
= first
;
5803 first
->prev
= newElmt
;
5808 } // CertPolicySet::PrependCopy
5811 // alloc new list elmt, insert it before the
5812 // current element, copy the given elmt into the new elmt
5813 // and return the component type.
5814 // if the current element is null, the new element
5815 // is placed at the beginning of the list.
5816 CertPolicySet
&CertPolicySet::InsertBeforeAndCopy (CertPolicyId
&elmt
)
5818 AsnListElmt
*newElmt
;
5820 newElmt
= new AsnListElmt
;
5821 newElmt
->elmt
= new CertPolicyId
;
5822 *newElmt
->elmt
= elmt
;
5826 newElmt
->next
= first
;
5827 newElmt
->prev
= NULL
;
5834 newElmt
->next
= curr
;
5835 newElmt
->prev
= curr
->prev
;
5836 curr
->prev
= newElmt
;
5840 newElmt
->prev
->next
= newElmt
;
5844 } // CertPolicySet::InsertBeforeAndCopy
5847 // alloc new list elmt, insert it after the
5848 // current element, copy given elmt in to new elmt
5849 // and return the component type
5850 // if the current element is null, the new element
5851 // is placed at the end of the list.
5852 CertPolicySet
&CertPolicySet::InsertAfterAndCopy (CertPolicyId
&elmt
)
5854 AsnListElmt
*newElmt
;
5856 newElmt
= new AsnListElmt
;
5857 newElmt
->elmt
= new CertPolicyId
;
5858 *newElmt
->elmt
= elmt
;
5861 newElmt
->prev
= last
;
5862 newElmt
->next
= NULL
;
5869 newElmt
->prev
= curr
;
5870 newElmt
->next
= curr
->next
;
5871 curr
->next
= newElmt
;
5875 newElmt
->next
->prev
= newElmt
;
5879 } // CertPolicySet::InsertAfterAndCopy
5882 // remove current element from list if current element is not NULL
5883 // The new current element will be the next element.
5884 // If the current element is the last element in the list
5885 // the second but last element will become the new current element.
5886 void CertPolicySet::RemoveCurrFromList()
5888 AsnListElmt
*del_elmt
;
5896 first
= last
= curr
= NULL
;
5897 else if (curr
== first
)
5899 curr
= first
= first
->next
;
5902 else if (curr
== last
)
5904 curr
= last
= last
->prev
;
5909 curr
->prev
->next
= curr
->next
;
5910 curr
->next
->prev
= curr
->prev
;
5913 delete del_elmt
->elmt
;
5919 AsnLen
CertPolicySet::BEncContent (BUF_TYPE b
)
5921 AsnListElmt
*currElmt
;
5923 AsnLen totalLen
= 0;
5924 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
5926 elmtLen
= currElmt
->elmt
->BEncContent (b
);
5927 elmtLen
+= BEncDefLen (b
, elmtLen
);
5929 elmtLen
+= BEncTag1 (b
, UNIV
, PRIM
, OID_TAG_CODE
);
5930 totalLen
+= elmtLen
;
5933 } // CertPolicySet::BEncContent
5936 void CertPolicySet::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
5937 AsnLen
&bytesDecoded
, ENV_TYPE env
)
5939 CertPolicyId
*listElmt
;
5941 AsnLen listBytesDecoded
= 0;
5944 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
5946 tag1
= BDecTag (b
, listBytesDecoded
, env
);
5947 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
5949 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
5952 if ((tag1
!= MAKE_TAG_ID (UNIV
, PRIM
, OID_TAG_CODE
)))
5954 Asn1Error
<< "Unexpected Tag" << endl
;
5955 SnaccExcep::throwMe(-142);
5958 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
5959 listElmt
= Append();
5960 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
5963 bytesDecoded
+= listBytesDecoded
;
5964 } // CertPolicySet::BDecContent
5967 AsnType
*CRLDistPointsSyntax::Clone() const
5969 return new CRLDistPointsSyntax
;
5972 AsnType
*CRLDistPointsSyntax::Copy() const
5974 return new CRLDistPointsSyntax (*this);
5977 AsnLen
CRLDistPointsSyntax::BEnc (BUF_TYPE b
)
5980 l
= BEncContent (b
);
5981 l
+= BEncConsLen (b
, l
);
5982 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
5986 void CRLDistPointsSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
5991 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
5993 Asn1Error
<< "CRLDistPointsSyntax::BDec: ERROR - wrong tag" << endl
;
5994 SnaccExcep::throwMe(-143);
5996 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
5997 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6000 CRLDistPointsSyntax::CRLDistPointsSyntax (const CRLDistPointsSyntax
&)
6002 Asn1Error
<< "use of incompletely defined CRLDistPointsSyntax::CRLDistPointsSyntax (const CRLDistPointsSyntax &)" << endl
;
6006 CRLDistPointsSyntax::~CRLDistPointsSyntax()
6009 for (; Curr() != NULL
; RemoveCurrFromList())
6011 } // end of destructor
6014 CRLDistPointsSyntax
&CRLDistPointsSyntax::operator = (const CRLDistPointsSyntax
&that
)
6015 #else // SNACC_DEEP_COPY
6016 CRLDistPointsSyntax
&CRLDistPointsSyntax::operator = (const CRLDistPointsSyntax
&)
6017 #endif // SNACC_DEEP_COPY
6023 for (; Curr(); RemoveCurrFromList())
6026 //that.SetCurrToFirst();
6027 //for (; that.Curr(); that.GoNext())
6028 // AppendCopy (*that.Curr());
6029 for (const AsnListElmt
*run
=that
.first
; run
; run
=run
->next
)
6030 AppendCopy (*run
->elmt
);
6034 #else // SNACC_DEEP_COPY
6035 Asn1Error
<< "use of incompletely defined CRLDistPointsSyntax &CRLDistPointsSyntax::operator = (const CRLDistPointsSyntax &)" << endl
;
6037 // if your compiler complains here, check the -novolat option
6038 #endif // SNACC_DEEP_COPY
6041 void CRLDistPointsSyntax::Print (ostream
&os
) const
6044 os
<< "{ -- SEQUENCE/SET OF -- " << endl
;
6045 indentG
+= stdIndentG
;
6047 //for (; Curr() != NULL; GoNext())
6048 for (const AsnListElmt
*run
=first
; run
; run
=run
->next
)
6050 Indent (os
, indentG
);
6053 //if (Curr() != Last())
6058 indentG
-= stdIndentG
;
6059 Indent (os
, indentG
);
6067 void CRLDistPointsSyntax::SetCurrElmt (unsigned long int index
)
6069 unsigned long int i
;
6072 for (i
= 0; (i
< (count
-1)) && (i
< index
); i
++)
6074 } // CRLDistPointsSyntax::SetCurrElmt
6077 unsigned long int CRLDistPointsSyntax::GetCurrElmtIndex()
6079 unsigned long int i
;
6083 for (i
= 0, tmp
= first
; tmp
!= NULL
; i
++)
6092 } // CRLDistPointsSyntax::GetCurrElmtIndex
6095 // alloc new list elmt, put at end of list
6096 // and return the component type
6097 DistributionPoint
*CRLDistPointsSyntax::Append()
6099 AsnListElmt
*newElmt
;
6100 newElmt
= new AsnListElmt
;
6101 newElmt
->elmt
= new DistributionPoint
;
6102 newElmt
->next
= NULL
;
6105 newElmt
->prev
= NULL
;
6106 first
= last
= newElmt
;
6110 newElmt
->prev
= last
;
6111 last
->next
= newElmt
;
6115 return (curr
= newElmt
)->elmt
;
6116 } // CRLDistPointsSyntax::Append
6119 // alloc new list elmt, put at begining of list
6120 // and return the component type
6121 DistributionPoint
*CRLDistPointsSyntax::Prepend()
6123 AsnListElmt
*newElmt
;
6124 newElmt
= new AsnListElmt
;
6125 newElmt
->elmt
= new DistributionPoint
;
6126 newElmt
->prev
= NULL
;
6129 newElmt
->next
= NULL
;
6130 first
= last
= newElmt
;
6134 newElmt
->next
= first
;
6135 first
->prev
= newElmt
;
6139 return (curr
= newElmt
)->elmt
;
6140 } // CRLDistPointsSyntax::Prepend
6143 // alloc new list elmt, insert it before the
6144 // current element and return the component type
6145 // if the current element is null, the new element
6146 // is placed at the beginning of the list.
6147 DistributionPoint
*CRLDistPointsSyntax::InsertBefore()
6149 AsnListElmt
*newElmt
;
6150 newElmt
= new AsnListElmt
;
6151 newElmt
->elmt
= new DistributionPoint
;
6154 newElmt
->next
= first
;
6155 newElmt
->prev
= NULL
;
6162 newElmt
->next
= curr
;
6163 newElmt
->prev
= curr
->prev
;
6164 curr
->prev
= newElmt
;
6168 newElmt
->prev
->next
= newElmt
;
6171 return (curr
= newElmt
)->elmt
;
6172 } // CRLDistPointsSyntax::InsertBefore
6175 // alloc new list elmt, insert it after the
6176 // current element and return the component type
6177 // if the current element is null, the new element
6178 // is placed at the end of the list.
6179 DistributionPoint
*CRLDistPointsSyntax::InsertAfter()
6181 AsnListElmt
*newElmt
;
6182 newElmt
= new AsnListElmt
;
6183 newElmt
->elmt
= new DistributionPoint
;
6186 newElmt
->prev
= last
;
6187 newElmt
->next
= NULL
;
6194 newElmt
->prev
= curr
;
6195 newElmt
->next
= curr
->next
;
6196 curr
->next
= newElmt
;
6200 newElmt
->next
->prev
= newElmt
;
6203 return (curr
= newElmt
)->elmt
;
6204 } // CRLDistPointsSyntax::InsertAfter
6207 CRLDistPointsSyntax
&CRLDistPointsSyntax::AppendCopy (DistributionPoint
&elmt
)
6209 AsnListElmt
*newElmt
;
6210 newElmt
= new AsnListElmt
;
6211 newElmt
->elmt
= new DistributionPoint
;
6212 *newElmt
->elmt
= elmt
;
6213 newElmt
->next
= NULL
;
6216 newElmt
->prev
= NULL
;
6217 first
= last
= newElmt
;
6221 newElmt
->prev
= last
;
6222 last
->next
= newElmt
;
6230 CRLDistPointsSyntax
&CRLDistPointsSyntax::PrependCopy (DistributionPoint
&elmt
)
6232 AsnListElmt
*newElmt
;
6233 newElmt
= new AsnListElmt
;
6234 newElmt
->elmt
= new DistributionPoint
;
6235 *newElmt
->elmt
= elmt
;
6236 newElmt
->prev
= NULL
;
6239 newElmt
->next
= NULL
;
6240 first
= last
= newElmt
;
6244 newElmt
->next
= first
;
6245 first
->prev
= newElmt
;
6250 } // CRLDistPointsSyntax::PrependCopy
6253 // alloc new list elmt, insert it before the
6254 // current element, copy the given elmt into the new elmt
6255 // and return the component type.
6256 // if the current element is null, the new element
6257 // is placed at the beginning of the list.
6258 CRLDistPointsSyntax
&CRLDistPointsSyntax::InsertBeforeAndCopy (DistributionPoint
&elmt
)
6260 AsnListElmt
*newElmt
;
6262 newElmt
= new AsnListElmt
;
6263 newElmt
->elmt
= new DistributionPoint
;
6264 *newElmt
->elmt
= elmt
;
6268 newElmt
->next
= first
;
6269 newElmt
->prev
= NULL
;
6276 newElmt
->next
= curr
;
6277 newElmt
->prev
= curr
->prev
;
6278 curr
->prev
= newElmt
;
6282 newElmt
->prev
->next
= newElmt
;
6286 } // CRLDistPointsSyntax::InsertBeforeAndCopy
6289 // alloc new list elmt, insert it after the
6290 // current element, copy given elmt in to new elmt
6291 // and return the component type
6292 // if the current element is null, the new element
6293 // is placed at the end of the list.
6294 CRLDistPointsSyntax
&CRLDistPointsSyntax::InsertAfterAndCopy (DistributionPoint
&elmt
)
6296 AsnListElmt
*newElmt
;
6298 newElmt
= new AsnListElmt
;
6299 newElmt
->elmt
= new DistributionPoint
;
6300 *newElmt
->elmt
= elmt
;
6303 newElmt
->prev
= last
;
6304 newElmt
->next
= NULL
;
6311 newElmt
->prev
= curr
;
6312 newElmt
->next
= curr
->next
;
6313 curr
->next
= newElmt
;
6317 newElmt
->next
->prev
= newElmt
;
6321 } // CRLDistPointsSyntax::InsertAfterAndCopy
6324 // remove current element from list if current element is not NULL
6325 // The new current element will be the next element.
6326 // If the current element is the last element in the list
6327 // the second but last element will become the new current element.
6328 void CRLDistPointsSyntax::RemoveCurrFromList()
6330 AsnListElmt
*del_elmt
;
6338 first
= last
= curr
= NULL
;
6339 else if (curr
== first
)
6341 curr
= first
= first
->next
;
6344 else if (curr
== last
)
6346 curr
= last
= last
->prev
;
6351 curr
->prev
->next
= curr
->next
;
6352 curr
->next
->prev
= curr
->prev
;
6355 delete del_elmt
->elmt
;
6361 AsnLen
CRLDistPointsSyntax::BEncContent (BUF_TYPE b
)
6363 AsnListElmt
*currElmt
;
6365 AsnLen totalLen
= 0;
6366 for (currElmt
= last
; currElmt
!= NULL
; currElmt
= currElmt
->prev
)
6369 elmtLen
= currElmt
->elmt
->BEncContent (b
);
6370 elmtLen
+= BEncConsLen (b
, elmtLen
);
6372 elmtLen
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6373 totalLen
+= elmtLen
;
6376 } // CRLDistPointsSyntax::BEncContent
6379 void CRLDistPointsSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
,
6380 AsnLen
&bytesDecoded
, ENV_TYPE env
)
6382 DistributionPoint
*listElmt
;
6384 AsnLen listBytesDecoded
= 0;
6387 while ((listBytesDecoded
< elmtLen0
) || (elmtLen0
== INDEFINITE_LEN
))
6389 tag1
= BDecTag (b
, listBytesDecoded
, env
);
6390 if ((tag1
== EOC_TAG_ID
) && (elmtLen0
== INDEFINITE_LEN
))
6392 BDEC_2ND_EOC_OCTET (b
, listBytesDecoded
, env
);
6395 if ((tag1
!= MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
)))
6397 Asn1Error
<< "Unexpected Tag" << endl
;
6398 SnaccExcep::throwMe(-144);
6401 elmtLen1
= BDecLen (b
, listBytesDecoded
, env
);
6402 listElmt
= Append();
6403 listElmt
->BDecContent (b
, tag1
, elmtLen1
, listBytesDecoded
, env
);
6406 bytesDecoded
+= listBytesDecoded
;
6407 } // CRLDistPointsSyntax::BDecContent
6410 IssuingDistPointSyntax::IssuingDistPointSyntax()
6412 distributionPoint
= NULL
;
6413 onlyContainsUserCerts
= NULL
;
6414 onlyContainsCACerts
= NULL
;
6415 onlySomeReasons
= NULL
;
6419 IssuingDistPointSyntax::IssuingDistPointSyntax (const IssuingDistPointSyntax
&)
6421 Asn1Error
<< "use of incompletely defined IssuingDistPointSyntax::IssuingDistPointSyntax (const IssuingDistPointSyntax &)" << endl
;
6425 IssuingDistPointSyntax::~IssuingDistPointSyntax()
6427 delete distributionPoint
;
6428 delete onlyContainsUserCerts
;
6429 delete onlyContainsCACerts
;
6430 delete onlySomeReasons
;
6434 AsnType
*IssuingDistPointSyntax::Clone() const
6436 return new IssuingDistPointSyntax
;
6439 AsnType
*IssuingDistPointSyntax::Copy() const
6441 return new IssuingDistPointSyntax (*this);
6445 IssuingDistPointSyntax
&IssuingDistPointSyntax::operator = (const IssuingDistPointSyntax
&that
)
6446 #else // SNACC_DEEP_COPY
6447 IssuingDistPointSyntax
&IssuingDistPointSyntax::operator = (const IssuingDistPointSyntax
&)
6448 #endif // SNACC_DEEP_COPY
6453 if (that
.distributionPoint
)
6455 if (!distributionPoint
)
6456 distributionPoint
= new DistributionPointName
;
6457 *distributionPoint
= *that
.distributionPoint
;
6461 delete distributionPoint
;
6462 distributionPoint
= NULL
;
6464 if (that
.onlyContainsUserCerts
)
6466 if (!onlyContainsUserCerts
)
6467 onlyContainsUserCerts
= new AsnBool
;
6468 *onlyContainsUserCerts
= *that
.onlyContainsUserCerts
;
6472 delete onlyContainsUserCerts
;
6473 onlyContainsUserCerts
= NULL
;
6475 if (that
.onlyContainsCACerts
)
6477 if (!onlyContainsCACerts
)
6478 onlyContainsCACerts
= new AsnBool
;
6479 *onlyContainsCACerts
= *that
.onlyContainsCACerts
;
6483 delete onlyContainsCACerts
;
6484 onlyContainsCACerts
= NULL
;
6486 if (that
.onlySomeReasons
)
6488 if (!onlySomeReasons
)
6489 onlySomeReasons
= new ReasonFlags
;
6490 *onlySomeReasons
= *that
.onlySomeReasons
;
6494 delete onlySomeReasons
;
6495 onlySomeReasons
= NULL
;
6497 if (that
.indirectCRL
)
6500 indirectCRL
= new AsnBool
;
6501 *indirectCRL
= *that
.indirectCRL
;
6511 #else // SNACC_DEEP_COPY
6512 Asn1Error
<< "use of incompletely defined IssuingDistPointSyntax &IssuingDistPointSyntax::operator = (const IssuingDistPointSyntax &)" << endl
;
6514 // if your compiler complains here, check the -novolat option
6515 #endif // SNACC_DEEP_COPY
6519 IssuingDistPointSyntax::BEncContent (BUF_TYPE b
)
6521 AsnLen totalLen
= 0;
6524 if (NOT_NULL (indirectCRL
))
6526 l
= indirectCRL
->BEncContent (b
);
6527 BEncDefLenTo127 (b
, l
);
6530 l
+= BEncTag1 (b
, CNTX
, PRIM
, 4);
6534 if (NOT_NULL (onlySomeReasons
))
6536 l
= onlySomeReasons
->BEncContent (b
);
6537 l
+= BEncDefLen (b
, l
);
6539 l
+= BEncTag1 (b
, CNTX
, PRIM
, 3);
6543 if (NOT_NULL (onlyContainsCACerts
))
6545 l
= onlyContainsCACerts
->BEncContent (b
);
6546 BEncDefLenTo127 (b
, l
);
6549 l
+= BEncTag1 (b
, CNTX
, PRIM
, 2);
6553 if (NOT_NULL (onlyContainsUserCerts
))
6555 l
= onlyContainsUserCerts
->BEncContent (b
);
6556 BEncDefLenTo127 (b
, l
);
6559 l
+= BEncTag1 (b
, CNTX
, PRIM
, 1);
6563 if (NOT_NULL (distributionPoint
))
6566 l
= distributionPoint
->BEncContent (b
);
6567 l
+= BEncConsLen (b
, l
);
6569 l
+= BEncTag1 (b
, CNTX
, CONS
, 0);
6574 } // IssuingDistPointSyntax::BEncContent
6577 void IssuingDistPointSyntax::BDecContent (BUF_TYPE b
, AsnTag
/*tag0*/, AsnLen elmtLen0
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6580 AsnLen seqBytesDecoded
= 0;
6587 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6589 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6591 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6592 bytesDecoded
+= seqBytesDecoded
;
6597 if ((tag1
== MAKE_TAG_ID (CNTX
, CONS
, 0)))
6599 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6600 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6601 elmtLen2
= BDecLen (b
, seqBytesDecoded
, env
);
6602 distributionPoint
= new DistributionPointName
;
6603 distributionPoint
->BDecContent (b
, tag1
, elmtLen2
, seqBytesDecoded
, env
);
6604 if (elmtLen1
== INDEFINITE_LEN
)
6605 BDecEoc (b
, seqBytesDecoded
, env
);
6607 if (seqBytesDecoded
== elmtLen0
)
6609 bytesDecoded
+= seqBytesDecoded
;
6614 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6616 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6618 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6619 bytesDecoded
+= seqBytesDecoded
;
6625 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 1)))
6627 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6628 onlyContainsUserCerts
= new AsnBool
;
6629 onlyContainsUserCerts
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6630 if (seqBytesDecoded
== elmtLen0
)
6632 bytesDecoded
+= seqBytesDecoded
;
6637 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6639 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6641 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6642 bytesDecoded
+= seqBytesDecoded
;
6648 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 2)))
6650 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6651 onlyContainsCACerts
= new AsnBool
;
6652 onlyContainsCACerts
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6653 if (seqBytesDecoded
== elmtLen0
)
6655 bytesDecoded
+= seqBytesDecoded
;
6660 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6662 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6664 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6665 bytesDecoded
+= seqBytesDecoded
;
6671 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 3))
6672 || (tag1
== MAKE_TAG_ID (CNTX
, CONS
, 3)))
6674 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6675 onlySomeReasons
= new ReasonFlags
;
6676 onlySomeReasons
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6677 if (seqBytesDecoded
== elmtLen0
)
6679 bytesDecoded
+= seqBytesDecoded
;
6684 tag1
= BDecTag (b
, seqBytesDecoded
, env
);
6686 if ((elmtLen0
== INDEFINITE_LEN
) && (tag1
== EOC_TAG_ID
))
6688 BDEC_2ND_EOC_OCTET (b
, seqBytesDecoded
, env
)
6689 bytesDecoded
+= seqBytesDecoded
;
6695 if ((tag1
== MAKE_TAG_ID (CNTX
, PRIM
, 4)))
6697 elmtLen1
= BDecLen (b
, seqBytesDecoded
, env
);
6698 indirectCRL
= new AsnBool
;
6699 indirectCRL
->BDecContent (b
, tag1
, elmtLen1
, seqBytesDecoded
, env
);
6702 bytesDecoded
+= seqBytesDecoded
;
6703 if (elmtLen0
== INDEFINITE_LEN
)
6705 BDecEoc (b
, bytesDecoded
, env
);
6708 else if (seqBytesDecoded
!= elmtLen0
)
6710 Asn1Error
<< "ERROR - Length discrepancy on sequence." << endl
;
6711 SnaccExcep::throwMe(-145);
6715 } // IssuingDistPointSyntax::BDecContent
6717 AsnLen
IssuingDistPointSyntax::BEnc (BUF_TYPE b
)
6720 l
= BEncContent (b
);
6721 l
+= BEncConsLen (b
, l
);
6722 l
+= BEncTag1 (b
, UNIV
, CONS
, SEQ_TAG_CODE
);
6726 void IssuingDistPointSyntax::BDec (BUF_TYPE b
, AsnLen
&bytesDecoded
, ENV_TYPE env
)
6731 if ((tag
= BDecTag (b
, bytesDecoded
, env
)) != MAKE_TAG_ID (UNIV
, CONS
, SEQ_TAG_CODE
))
6733 Asn1Error
<< "IssuingDistPointSyntax::BDec: ERROR - wrong tag" << endl
;
6734 SnaccExcep::throwMe(-146);
6736 elmtLen1
= BDecLen (b
, bytesDecoded
, env
);
6737 BDecContent (b
, tag
, elmtLen1
, bytesDecoded
, env
);
6740 void IssuingDistPointSyntax::Print (ostream
&os
) const
6743 int nonePrinted
= true;
6744 os
<< "{ -- SEQUENCE --" << endl
;
6745 indentG
+= stdIndentG
;
6747 if (NOT_NULL (distributionPoint
))
6749 nonePrinted
= false;
6750 Indent (os
, indentG
);
6751 os
<< "distributionPoint ";
6752 os
<< *distributionPoint
;
6756 Indent (os
, indentG
);
6757 os
<< "distributionPoint ";
6762 if (NOT_NULL (onlyContainsUserCerts
))
6766 nonePrinted
= false;
6767 Indent (os
, indentG
);
6768 os
<< "onlyContainsUserCerts ";
6769 os
<< *onlyContainsUserCerts
;
6773 Indent (os
, indentG
);
6774 os
<< "onlyContainsUserCerts ";
6779 if (NOT_NULL (onlyContainsCACerts
))
6783 nonePrinted
= false;
6784 Indent (os
, indentG
);
6785 os
<< "onlyContainsCACerts ";
6786 os
<< *onlyContainsCACerts
;
6790 Indent (os
, indentG
);
6791 os
<< "onlyContainsCACerts ";
6796 if (NOT_NULL (onlySomeReasons
))
6800 nonePrinted
= false;
6801 Indent (os
, indentG
);
6802 os
<< "onlySomeReasons ";
6803 os
<< *onlySomeReasons
;
6807 Indent (os
, indentG
);
6808 os
<< "onlySomeReasons ";
6813 if (NOT_NULL (indirectCRL
))
6817 nonePrinted
= false;
6818 Indent (os
, indentG
);
6819 os
<< "indirectCRL ";
6824 Indent (os
, indentG
);
6825 os
<< "indirectCRL ";
6831 indentG
-= stdIndentG
;
6832 Indent (os
, indentG
);
6835 } // IssuingDistPointSyntax::Print