// NOTE: this is a machine generated file--editing not recommended // // appleoids.cpp - class member functions for ASN.1 module APPLE-OIDS // // This file was generated by snacc on Wed Jun 27 16:40:55 2001 // UBC snacc written by Mike Sample // A couple of enhancements made by IBM European Networking Center #include "asn-incl.h" #include "sm_vdatypes.h" #include "sm_x501ud.h" #include "sm_x411ub.h" #include "sm_x411mtsas.h" #include "sm_x501if.h" #include "sm_x520sa.h" #include "sm_x509cmn.h" #include "sm_x509af.h" #include "sm_x509ce.h" #include "pkcs1oids.h" #include "pkcs9oids.h" #include "sm_cms.h" #include "sm_ess.h" #include "pkcs7.h" #include "pkcs8.h" #include "appleoids.h" //------------------------------------------------------------------------------ // value defs //------------------------------------------------------------------------------ // class member definitions: DSABsafeParams::DSABsafeParams() { } DSABsafeParams::DSABsafeParams (const DSABsafeParams &) { Asn1Error << "use of incompletely defined DSABsafeParams::DSABsafeParams (const DSABsafeParams &)" << endl; abort(); } DSABsafeParams::~DSABsafeParams() { } AsnType *DSABsafeParams::Clone() const { return new DSABsafeParams; } AsnType *DSABsafeParams::Copy() const { return new DSABsafeParams (*this); } #if SNACC_DEEP_COPY DSABsafeParams &DSABsafeParams::operator = (const DSABsafeParams &that) #else // SNACC_DEEP_COPY DSABsafeParams &DSABsafeParams::operator = (const DSABsafeParams &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { keySizeInBits = that.keySizeInBits; p = that.p; q = that.q; g = that.g; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined DSABsafeParams &DSABsafeParams::operator = (const DSABsafeParams &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen DSABsafeParams::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = g.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = q.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = p.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = keySizeInBits.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // DSABsafeParams::BEncContent void DSABsafeParams::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); keySizeInBits.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -100); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); p.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -101); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); q.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -102); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); g.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -103); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -104); } else return; } // DSABsafeParams::BDecContent AsnLen DSABsafeParams::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void DSABsafeParams::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "DSABsafeParams::BDec: ERROR - wrong tag" << endl; longjmp (env, -105); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int DSABsafeParams::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int DSABsafeParams::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void DSABsafeParams::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "keySizeInBits "; os << keySizeInBits; os << "," << endl; } { Indent (os, indentG); os << "p "; os << p; os << "," << endl; } { Indent (os, indentG); os << "q "; os << q; os << "," << endl; } { Indent (os, indentG); os << "g "; os << g; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // DSABsafeParams::Print FEECurveParameters::FEECurveParameters() { basePrime = NULL; } FEECurveParameters::FEECurveParameters (const FEECurveParameters &) { Asn1Error << "use of incompletely defined FEECurveParameters::FEECurveParameters (const FEECurveParameters &)" << endl; abort(); } FEECurveParameters::~FEECurveParameters() { delete basePrime; } AsnType *FEECurveParameters::Clone() const { return new FEECurveParameters; } AsnType *FEECurveParameters::Copy() const { return new FEECurveParameters (*this); } #if SNACC_DEEP_COPY FEECurveParameters &FEECurveParameters::operator = (const FEECurveParameters &that) #else // SNACC_DEEP_COPY FEECurveParameters &FEECurveParameters::operator = (const FEECurveParameters &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { primeType = that.primeType; curveType = that.curveType; q = that.q; k = that.k; m = that.m; a = that.a; bb = that.bb; c = that.c; x1Plus = that.x1Plus; x1Minus = that.x1Minus; cOrderPlus = that.cOrderPlus; cOrderMinus = that.cOrderMinus; x1OrderPlus = that.x1OrderPlus; x1OrderMinus = that.x1OrderMinus; if (that.basePrime) { if (!basePrime) basePrime = new BigIntegerStr; *basePrime = *that.basePrime; } else { delete basePrime; basePrime = NULL; } } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined FEECurveParameters &FEECurveParameters::operator = (const FEECurveParameters &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen FEECurveParameters::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; if (NOT_NULL (basePrime)) { l = basePrime->BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; } l = x1OrderMinus.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = x1OrderPlus.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = cOrderMinus.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = cOrderPlus.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = x1Minus.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = x1Plus.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = c.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = bb.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = a.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = m.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = k.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = q.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = curveType.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = primeType.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // FEECurveParameters::BEncContent void FEECurveParameters::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); primeType.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -106); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); curveType.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -107); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); q.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -108); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); k.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -109); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); m.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -110); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); a.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -111); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); bb.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -112); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); c.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -113); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); x1Plus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -114); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); x1Minus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -115); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); cOrderPlus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -116); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); cOrderMinus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -117); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); x1OrderPlus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -118); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); x1OrderMinus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); if (seqBytesDecoded == elmtLen0) { bytesDecoded += seqBytesDecoded; return; } else { tag1 = BDecTag (b, seqBytesDecoded, env); if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID)) { BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env) bytesDecoded += seqBytesDecoded; return; } } } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -119); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); basePrime = new BigIntegerStr; basePrime->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -120); } else return; } // FEECurveParameters::BDecContent AsnLen FEECurveParameters::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void FEECurveParameters::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "FEECurveParameters::BDec: ERROR - wrong tag" << endl; longjmp (env, -121); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int FEECurveParameters::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int FEECurveParameters::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void FEECurveParameters::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "primeType "; os << primeType; os << "," << endl; } { Indent (os, indentG); os << "curveType "; os << curveType; os << "," << endl; } { Indent (os, indentG); os << "q "; os << q; os << "," << endl; } { Indent (os, indentG); os << "k "; os << k; os << "," << endl; } { Indent (os, indentG); os << "m "; os << m; os << "," << endl; } { Indent (os, indentG); os << "a "; os << a; os << "," << endl; } { Indent (os, indentG); os << "bb "; os << bb; os << "," << endl; } { Indent (os, indentG); os << "c "; os << c; os << "," << endl; } { Indent (os, indentG); os << "x1Plus "; os << x1Plus; os << "," << endl; } { Indent (os, indentG); os << "x1Minus "; os << x1Minus; os << "," << endl; } { Indent (os, indentG); os << "cOrderPlus "; os << cOrderPlus; os << "," << endl; } { Indent (os, indentG); os << "cOrderMinus "; os << cOrderMinus; os << "," << endl; } { Indent (os, indentG); os << "x1OrderPlus "; os << x1OrderPlus; os << "," << endl; } { Indent (os, indentG); os << "x1OrderMinus "; os << x1OrderMinus; os << "," << endl; } if (NOT_NULL (basePrime)) { os << ","<< endl; Indent (os, indentG); os << "basePrime "; os << *basePrime; } else { Indent (os, indentG); os << "basePrime "; os << "-- void --"; os << endl; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // FEECurveParameters::Print DSAAlgorithmId::DSAAlgorithmId() { #if TCL params = new DSABsafeParams; #else params = NULL; // incomplete initialization of mandatory element! #endif // TCL } DSAAlgorithmId::DSAAlgorithmId (const DSAAlgorithmId &) { Asn1Error << "use of incompletely defined DSAAlgorithmId::DSAAlgorithmId (const DSAAlgorithmId &)" << endl; abort(); } DSAAlgorithmId::~DSAAlgorithmId() { delete params; } AsnType *DSAAlgorithmId::Clone() const { return new DSAAlgorithmId; } AsnType *DSAAlgorithmId::Copy() const { return new DSAAlgorithmId (*this); } #if SNACC_DEEP_COPY DSAAlgorithmId &DSAAlgorithmId::operator = (const DSAAlgorithmId &that) #else // SNACC_DEEP_COPY DSAAlgorithmId &DSAAlgorithmId::operator = (const DSAAlgorithmId &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { algorithm = that.algorithm; if (that.params) { if (!params) params = new DSABsafeParams; *params = *that.params; } else { delete params; params = NULL; } } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined DSAAlgorithmId &DSAAlgorithmId::operator = (const DSAAlgorithmId &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen DSAAlgorithmId::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; BEncEocIfNec (b); l = params->BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); totalLen += l; l = algorithm.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE); totalLen += l; return totalLen; } // DSAAlgorithmId::BEncContent void DSAAlgorithmId::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); algorithm.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -122); } if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); params = new DSABsafeParams; params->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -123); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -124); } else return; } // DSAAlgorithmId::BDecContent AsnLen DSAAlgorithmId::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void DSAAlgorithmId::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "DSAAlgorithmId::BDec: ERROR - wrong tag" << endl; longjmp (env, -125); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int DSAAlgorithmId::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int DSAAlgorithmId::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void DSAAlgorithmId::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "algorithm "; os << algorithm; os << "," << endl; } if (NOT_NULL (params)) { Indent (os, indentG); os << "params "; os << *params; } else { Indent (os, indentG); os << "params "; os << "-- void --"; os << endl; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // DSAAlgorithmId::Print FEEElGamalSignature::FEEElGamalSignature() { } FEEElGamalSignature::FEEElGamalSignature (const FEEElGamalSignature &) { Asn1Error << "use of incompletely defined FEEElGamalSignature::FEEElGamalSignature (const FEEElGamalSignature &)" << endl; abort(); } FEEElGamalSignature::~FEEElGamalSignature() { } AsnType *FEEElGamalSignature::Clone() const { return new FEEElGamalSignature; } AsnType *FEEElGamalSignature::Copy() const { return new FEEElGamalSignature (*this); } #if SNACC_DEEP_COPY FEEElGamalSignature &FEEElGamalSignature::operator = (const FEEElGamalSignature &that) #else // SNACC_DEEP_COPY FEEElGamalSignature &FEEElGamalSignature::operator = (const FEEElGamalSignature &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { u = that.u; pmX = that.pmX; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined FEEElGamalSignature &FEEElGamalSignature::operator = (const FEEElGamalSignature &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen FEEElGamalSignature::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = pmX.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = u.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // FEEElGamalSignature::BEncContent void FEEElGamalSignature::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); u.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -126); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); pmX.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -127); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -128); } else return; } // FEEElGamalSignature::BDecContent AsnLen FEEElGamalSignature::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void FEEElGamalSignature::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "FEEElGamalSignature::BDec: ERROR - wrong tag" << endl; longjmp (env, -129); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int FEEElGamalSignature::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int FEEElGamalSignature::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void FEEElGamalSignature::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "u "; os << u; os << "," << endl; } { Indent (os, indentG); os << "pmX "; os << pmX; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // FEEElGamalSignature::Print FEEECDSASignature::FEEECDSASignature() { } FEEECDSASignature::FEEECDSASignature (const FEEECDSASignature &) { Asn1Error << "use of incompletely defined FEEECDSASignature::FEEECDSASignature (const FEEECDSASignature &)" << endl; abort(); } FEEECDSASignature::~FEEECDSASignature() { } AsnType *FEEECDSASignature::Clone() const { return new FEEECDSASignature; } AsnType *FEEECDSASignature::Copy() const { return new FEEECDSASignature (*this); } #if SNACC_DEEP_COPY FEEECDSASignature &FEEECDSASignature::operator = (const FEEECDSASignature &that) #else // SNACC_DEEP_COPY FEEECDSASignature &FEEECDSASignature::operator = (const FEEECDSASignature &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { c = that.c; d = that.d; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined FEEECDSASignature &FEEECDSASignature::operator = (const FEEECDSASignature &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen FEEECDSASignature::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = d.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = c.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // FEEECDSASignature::BEncContent void FEEECDSASignature::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); c.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -130); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); d.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -131); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -132); } else return; } // FEEECDSASignature::BDecContent AsnLen FEEECDSASignature::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void FEEECDSASignature::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "FEEECDSASignature::BDec: ERROR - wrong tag" << endl; longjmp (env, -133); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int FEEECDSASignature::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int FEEECDSASignature::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void FEEECDSASignature::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "c "; os << c; os << "," << endl; } { Indent (os, indentG); os << "d "; os << d; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // FEEECDSASignature::Print FEEPublicKey::FEEPublicKey() { #if TCL curveParams = new FEECurveParameters; #else curveParams = NULL; // incomplete initialization of mandatory element! #endif // TCL plusY = NULL; } FEEPublicKey::FEEPublicKey (const FEEPublicKey &) { Asn1Error << "use of incompletely defined FEEPublicKey::FEEPublicKey (const FEEPublicKey &)" << endl; abort(); } FEEPublicKey::~FEEPublicKey() { delete curveParams; delete plusY; } AsnType *FEEPublicKey::Clone() const { return new FEEPublicKey; } AsnType *FEEPublicKey::Copy() const { return new FEEPublicKey (*this); } #if SNACC_DEEP_COPY FEEPublicKey &FEEPublicKey::operator = (const FEEPublicKey &that) #else // SNACC_DEEP_COPY FEEPublicKey &FEEPublicKey::operator = (const FEEPublicKey &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { version = that.version; if (that.curveParams) { if (!curveParams) curveParams = new FEECurveParameters; *curveParams = *that.curveParams; } else { delete curveParams; curveParams = NULL; } plusX = that.plusX; minusX = that.minusX; if (that.plusY) { if (!plusY) plusY = new BigIntegerStr; *plusY = *that.plusY; } else { delete plusY; plusY = NULL; } } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined FEEPublicKey &FEEPublicKey::operator = (const FEEPublicKey &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen FEEPublicKey::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; if (NOT_NULL (plusY)) { l = plusY->BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; } l = minusX.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = plusX.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; BEncEocIfNec (b); l = curveParams->BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); totalLen += l; l = version.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // FEEPublicKey::BEncContent void FEEPublicKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); version.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -134); } if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); curveParams = new FEECurveParameters; curveParams->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -135); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); plusX.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -136); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); minusX.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); if (seqBytesDecoded == elmtLen0) { bytesDecoded += seqBytesDecoded; return; } else { tag1 = BDecTag (b, seqBytesDecoded, env); if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID)) { BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env) bytesDecoded += seqBytesDecoded; return; } } } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -137); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); plusY = new BigIntegerStr; plusY->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -138); } else return; } // FEEPublicKey::BDecContent AsnLen FEEPublicKey::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void FEEPublicKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "FEEPublicKey::BDec: ERROR - wrong tag" << endl; longjmp (env, -139); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int FEEPublicKey::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int FEEPublicKey::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void FEEPublicKey::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "version "; os << version; os << "," << endl; } if (NOT_NULL (curveParams)) { Indent (os, indentG); os << "curveParams "; os << *curveParams; } else { Indent (os, indentG); os << "curveParams "; os << "-- void --"; os << "," << endl; } { Indent (os, indentG); os << "plusX "; os << plusX; os << "," << endl; } { Indent (os, indentG); os << "minusX "; os << minusX; os << "," << endl; } if (NOT_NULL (plusY)) { os << ","<< endl; Indent (os, indentG); os << "plusY "; os << *plusY; } else { Indent (os, indentG); os << "plusY "; os << "-- void --"; os << endl; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // FEEPublicKey::Print FEEPrivateKey::FEEPrivateKey() { #if TCL curveParams = new FEECurveParameters; #else curveParams = NULL; // incomplete initialization of mandatory element! #endif // TCL } FEEPrivateKey::FEEPrivateKey (const FEEPrivateKey &) { Asn1Error << "use of incompletely defined FEEPrivateKey::FEEPrivateKey (const FEEPrivateKey &)" << endl; abort(); } FEEPrivateKey::~FEEPrivateKey() { delete curveParams; } AsnType *FEEPrivateKey::Clone() const { return new FEEPrivateKey; } AsnType *FEEPrivateKey::Copy() const { return new FEEPrivateKey (*this); } #if SNACC_DEEP_COPY FEEPrivateKey &FEEPrivateKey::operator = (const FEEPrivateKey &that) #else // SNACC_DEEP_COPY FEEPrivateKey &FEEPrivateKey::operator = (const FEEPrivateKey &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { version = that.version; if (that.curveParams) { if (!curveParams) curveParams = new FEECurveParameters; *curveParams = *that.curveParams; } else { delete curveParams; curveParams = NULL; } privData = that.privData; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined FEEPrivateKey &FEEPrivateKey::operator = (const FEEPrivateKey &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen FEEPrivateKey::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = privData.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; BEncEocIfNec (b); l = curveParams->BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); totalLen += l; l = version.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // FEEPrivateKey::BEncContent void FEEPrivateKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); version.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -140); } if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); curveParams = new FEECurveParameters; curveParams->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -141); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); privData.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -142); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -143); } else return; } // FEEPrivateKey::BDecContent AsnLen FEEPrivateKey::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void FEEPrivateKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "FEEPrivateKey::BDec: ERROR - wrong tag" << endl; longjmp (env, -144); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int FEEPrivateKey::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int FEEPrivateKey::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void FEEPrivateKey::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "version "; os << version; os << "," << endl; } if (NOT_NULL (curveParams)) { Indent (os, indentG); os << "curveParams "; os << *curveParams; } else { Indent (os, indentG); os << "curveParams "; os << "-- void --"; os << "," << endl; } { Indent (os, indentG); os << "privData "; os << privData; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // FEEPrivateKey::Print DSAPrivateKey::DSAPrivateKey() { #if TCL dsaAlg = new DSAAlgorithmId; #else dsaAlg = NULL; // incomplete initialization of mandatory element! #endif // TCL } DSAPrivateKey::DSAPrivateKey (const DSAPrivateKey &) { Asn1Error << "use of incompletely defined DSAPrivateKey::DSAPrivateKey (const DSAPrivateKey &)" << endl; abort(); } DSAPrivateKey::~DSAPrivateKey() { delete dsaAlg; } AsnType *DSAPrivateKey::Clone() const { return new DSAPrivateKey; } AsnType *DSAPrivateKey::Copy() const { return new DSAPrivateKey (*this); } #if SNACC_DEEP_COPY DSAPrivateKey &DSAPrivateKey::operator = (const DSAPrivateKey &that) #else // SNACC_DEEP_COPY DSAPrivateKey &DSAPrivateKey::operator = (const DSAPrivateKey &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { version = that.version; if (that.dsaAlg) { if (!dsaAlg) dsaAlg = new DSAAlgorithmId; *dsaAlg = *that.dsaAlg; } else { delete dsaAlg; dsaAlg = NULL; } privateKey = that.privateKey; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined DSAPrivateKey &DSAPrivateKey::operator = (const DSAPrivateKey &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen DSAPrivateKey::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = privateKey.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE); totalLen += l; BEncEocIfNec (b); l = dsaAlg->BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); totalLen += l; l = version.BEncContent (b); BEncDefLenTo127 (b, l); l++; l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // DSAPrivateKey::BEncContent void DSAPrivateKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); version.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -145); } if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); dsaAlg = new DSAAlgorithmId; dsaAlg->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -146); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); privateKey.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -147); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -148); } else return; } // DSAPrivateKey::BDecContent AsnLen DSAPrivateKey::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void DSAPrivateKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "DSAPrivateKey::BDec: ERROR - wrong tag" << endl; longjmp (env, -149); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int DSAPrivateKey::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int DSAPrivateKey::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void DSAPrivateKey::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "version "; os << version; os << "," << endl; } if (NOT_NULL (dsaAlg)) { Indent (os, indentG); os << "dsaAlg "; os << *dsaAlg; } else { Indent (os, indentG); os << "dsaAlg "; os << "-- void --"; os << "," << endl; } { Indent (os, indentG); os << "privateKey "; os << privateKey; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // DSAPrivateKey::Print DSAPublicKey::DSAPublicKey() { #if TCL dsaAlg = new DSAAlgorithmId; #else dsaAlg = NULL; // incomplete initialization of mandatory element! #endif // TCL } DSAPublicKey::DSAPublicKey (const DSAPublicKey &) { Asn1Error << "use of incompletely defined DSAPublicKey::DSAPublicKey (const DSAPublicKey &)" << endl; abort(); } DSAPublicKey::~DSAPublicKey() { delete dsaAlg; } AsnType *DSAPublicKey::Clone() const { return new DSAPublicKey; } AsnType *DSAPublicKey::Copy() const { return new DSAPublicKey (*this); } #if SNACC_DEEP_COPY DSAPublicKey &DSAPublicKey::operator = (const DSAPublicKey &that) #else // SNACC_DEEP_COPY DSAPublicKey &DSAPublicKey::operator = (const DSAPublicKey &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { if (that.dsaAlg) { if (!dsaAlg) dsaAlg = new DSAAlgorithmId; *dsaAlg = *that.dsaAlg; } else { delete dsaAlg; dsaAlg = NULL; } publicKey = that.publicKey; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined DSAPublicKey &DSAPublicKey::operator = (const DSAPublicKey &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen DSAPublicKey::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = publicKey.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, BITSTRING_TAG_CODE); totalLen += l; BEncEocIfNec (b); l = dsaAlg->BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); totalLen += l; return totalLen; } // DSAPublicKey::BEncContent void DSAPublicKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); dsaAlg = new DSAAlgorithmId; dsaAlg->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -150); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, BITSTRING_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, BITSTRING_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); publicKey.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -151); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -152); } else return; } // DSAPublicKey::BDecContent AsnLen DSAPublicKey::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void DSAPublicKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "DSAPublicKey::BDec: ERROR - wrong tag" << endl; longjmp (env, -153); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int DSAPublicKey::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int DSAPublicKey::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void DSAPublicKey::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; if (NOT_NULL (dsaAlg)) { Indent (os, indentG); os << "dsaAlg "; os << *dsaAlg; } else { Indent (os, indentG); os << "dsaAlg "; os << "-- void --"; os << "," << endl; } { Indent (os, indentG); os << "publicKey "; os << publicKey; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // DSAPublicKey::Print DSAPrivateKeyOcts::DSAPrivateKeyOcts() { } DSAPrivateKeyOcts::DSAPrivateKeyOcts (const DSAPrivateKeyOcts &) { Asn1Error << "use of incompletely defined DSAPrivateKeyOcts::DSAPrivateKeyOcts (const DSAPrivateKeyOcts &)" << endl; abort(); } DSAPrivateKeyOcts::~DSAPrivateKeyOcts() { } AsnType *DSAPrivateKeyOcts::Clone() const { return new DSAPrivateKeyOcts; } AsnType *DSAPrivateKeyOcts::Copy() const { return new DSAPrivateKeyOcts (*this); } #if SNACC_DEEP_COPY DSAPrivateKeyOcts &DSAPrivateKeyOcts::operator = (const DSAPrivateKeyOcts &that) #else // SNACC_DEEP_COPY DSAPrivateKeyOcts &DSAPrivateKeyOcts::operator = (const DSAPrivateKeyOcts &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { privateKey = that.privateKey; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined DSAPrivateKeyOcts &DSAPrivateKeyOcts::operator = (const DSAPrivateKeyOcts &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen DSAPrivateKeyOcts::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = privateKey.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // DSAPrivateKeyOcts::BEncContent void DSAPrivateKeyOcts::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); privateKey.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -154); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -155); } else return; } // DSAPrivateKeyOcts::BDecContent AsnLen DSAPrivateKeyOcts::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void DSAPrivateKeyOcts::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "DSAPrivateKeyOcts::BDec: ERROR - wrong tag" << endl; longjmp (env, -156); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int DSAPrivateKeyOcts::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int DSAPrivateKeyOcts::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void DSAPrivateKeyOcts::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "privateKey "; os << privateKey; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // DSAPrivateKeyOcts::Print DSASignature::DSASignature() { } DSASignature::DSASignature (const DSASignature &) { Asn1Error << "use of incompletely defined DSASignature::DSASignature (const DSASignature &)" << endl; abort(); } DSASignature::~DSASignature() { } AsnType *DSASignature::Clone() const { return new DSASignature; } AsnType *DSASignature::Copy() const { return new DSASignature (*this); } #if SNACC_DEEP_COPY DSASignature &DSASignature::operator = (const DSASignature &that) #else // SNACC_DEEP_COPY DSASignature &DSASignature::operator = (const DSASignature &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { r = that.r; s = that.s; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined DSASignature &DSASignature::operator = (const DSASignature &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen DSASignature::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = s.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = r.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // DSASignature::BEncContent void DSASignature::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); r.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -157); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); s.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -158); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -159); } else return; } // DSASignature::BDecContent AsnLen DSASignature::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void DSASignature::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "DSASignature::BDec: ERROR - wrong tag" << endl; longjmp (env, -160); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int DSASignature::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int DSASignature::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void DSASignature::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "r "; os << r; os << "," << endl; } { Indent (os, indentG); os << "s "; os << s; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // DSASignature::Print DSAAlgParams::DSAAlgParams() { } DSAAlgParams::DSAAlgParams (const DSAAlgParams &) { Asn1Error << "use of incompletely defined DSAAlgParams::DSAAlgParams (const DSAAlgParams &)" << endl; abort(); } DSAAlgParams::~DSAAlgParams() { } AsnType *DSAAlgParams::Clone() const { return new DSAAlgParams; } AsnType *DSAAlgParams::Copy() const { return new DSAAlgParams (*this); } #if SNACC_DEEP_COPY DSAAlgParams &DSAAlgParams::operator = (const DSAAlgParams &that) #else // SNACC_DEEP_COPY DSAAlgParams &DSAAlgParams::operator = (const DSAAlgParams &) #endif // SNACC_DEEP_COPY { #if SNACC_DEEP_COPY if (this != &that) { p = that.p; q = that.q; g = that.g; } return *this; #else // SNACC_DEEP_COPY Asn1Error << "use of incompletely defined DSAAlgParams &DSAAlgParams::operator = (const DSAAlgParams &)" << endl; abort(); // if your compiler complains here, check the -novolat option #endif // SNACC_DEEP_COPY } AsnLen DSAAlgParams::BEncContent (BUF_TYPE b) { AsnLen totalLen = 0; AsnLen l; l = g.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = q.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; l = p.BEncContent (b); l += BEncDefLen (b, l); l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); totalLen += l; return totalLen; } // DSAAlgParams::BEncContent void DSAAlgParams::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag1; AsnLen seqBytesDecoded = 0; AsnLen elmtLen1; tag1 = BDecTag (b, seqBytesDecoded, env); if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); p.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -161); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); q.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); tag1 = BDecTag (b, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -162); } if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)) || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) { elmtLen1 = BDecLen (b, seqBytesDecoded, env); g.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); } else { Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; longjmp (env, -163); } bytesDecoded += seqBytesDecoded; if (elmtLen0 == INDEFINITE_LEN) { BDecEoc (b, bytesDecoded, env); return; } else if (seqBytesDecoded != elmtLen0) { Asn1Error << "ERROR - Length discrepancy on sequence." << endl; longjmp (env, -164); } else return; } // DSAAlgParams::BDecContent AsnLen DSAAlgParams::BEnc (BUF_TYPE b) { AsnLen l; l = BEncContent (b); l += BEncConsLen (b, l); l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); return l; } void DSAAlgParams::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) { AsnTag tag; AsnLen elmtLen1; if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) { Asn1Error << "DSAAlgParams::BDec: ERROR - wrong tag" << endl; longjmp (env, -165); } elmtLen1 = BDecLen (b, bytesDecoded, env); BDecContent (b, tag, elmtLen1, bytesDecoded, env); } int DSAAlgParams::BEncPdu (BUF_TYPE b, AsnLen &bytesEncoded) { bytesEncoded = BEnc (b); return !b.WriteError(); } int DSAAlgParams::BDecPdu (BUF_TYPE b, AsnLen &bytesDecoded) { ENV_TYPE env; int val; bytesDecoded = 0; if ((val = setjmp (env)) == 0) { BDec (b, bytesDecoded, env); return !b.ReadError(); } else return false; } void DSAAlgParams::Print (ostream &os) const { #ifndef NDEBUG os << "{ -- SEQUENCE --" << endl; indentG += stdIndentG; { Indent (os, indentG); os << "p "; os << p; os << "," << endl; } { Indent (os, indentG); os << "q "; os << q; os << "," << endl; } { Indent (os, indentG); os << "g "; os << g; } os << endl; indentG -= stdIndentG; Indent (os, indentG); os << "}"; #endif /* NDEBUG */ } // DSAAlgParams::Print