#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"
#include "pkcs10.h"
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();
#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;
}
void DSABsafeParams::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-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;
SnaccExcep::throwMe(-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;
SnaccExcep::throwMe(-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;
SnaccExcep::throwMe(-103);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-104);
}
else
return;
}
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;
SnaccExcep::throwMe(-105);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
DHParameter::DHParameter()
{
privateValueLength = NULL;
}
DHParameter::DHParameter (const DHParameter &)
{
Asn1Error << "use of incompletely defined DHParameter::DHParameter (const DHParameter &)" << endl;
abort();
}
DHParameter::~DHParameter()
{
delete privateValueLength;
}
AsnType *DHParameter::Clone() const
{
return new DHParameter;
}
AsnType *DHParameter::Copy() const
{
return new DHParameter (*this);
}
#if SNACC_DEEP_COPY
DHParameter &DHParameter::operator = (const DHParameter &that)
#else // SNACC_DEEP_COPY
DHParameter &DHParameter::operator = (const DHParameter &)
#endif // SNACC_DEEP_COPY
{
#if SNACC_DEEP_COPY
if (this != &that)
{
prime = that.prime;
base = that.base;
if (that.privateValueLength)
{
if (!privateValueLength)
privateValueLength = new BigIntegerStr;
*privateValueLength = *that.privateValueLength;
}
else
{
delete privateValueLength;
privateValueLength = NULL;
}
}
return *this;
#else // SNACC_DEEP_COPY
Asn1Error << "use of incompletely defined DHParameter &DHParameter::operator = (const DHParameter &)" << endl;
abort();
#endif // SNACC_DEEP_COPY
}
AsnLen
DHParameter::BEncContent (BUF_TYPE b)
{
AsnLen totalLen = 0;
AsnLen l;
if (NOT_NULL (privateValueLength))
{
l = privateValueLength->BEncContent (b);
l += BEncDefLen (b, l);
l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
totalLen += l;
}
l = base.BEncContent (b);
l += BEncDefLen (b, l);
l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
totalLen += l;
l = prime.BEncContent (b);
l += BEncDefLen (b, l);
l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
totalLen += l;
return totalLen;
}
void DHParameter::BDecContent (BUF_TYPE b, AsnTag , 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);
prime.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-106);
}
if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
|| (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
{
elmtLen1 = BDecLen (b, seqBytesDecoded, env);
base.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;
SnaccExcep::throwMe(-107);
}
if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
|| (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
{
elmtLen1 = BDecLen (b, seqBytesDecoded, env);
privateValueLength = new BigIntegerStr;
privateValueLength->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;
SnaccExcep::throwMe(-108);
}
else
return;
}
AsnLen DHParameter::BEnc (BUF_TYPE b)
{
AsnLen l;
l = BEncContent (b);
l += BEncConsLen (b, l);
l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
return l;
}
void DHParameter::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 << "DHParameter::BDec: ERROR - wrong tag" << endl;
SnaccExcep::throwMe(-109);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
void DHParameter::Print (ostream &os) const
{
#ifndef NDEBUG
os << "{ -- SEQUENCE --" << endl;
indentG += stdIndentG;
{
Indent (os, indentG);
os << "prime ";
os << prime;
os << "," << endl;
}
{
Indent (os, indentG);
os << "base ";
os << base;
os << "," << endl;
}
if (NOT_NULL (privateValueLength))
{
os << ","<< endl;
Indent (os, indentG);
os << "privateValueLength ";
os << *privateValueLength;
}
else
{
Indent (os, indentG);
os << "privateValueLength ";
os << "-- void --";
os << endl;
}
os << endl;
indentG -= stdIndentG;
Indent (os, indentG);
os << "}";
#endif
}
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();
#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;
}
void FEECurveParameters::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-110);
}
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;
SnaccExcep::throwMe(-111);
}
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;
SnaccExcep::throwMe(-112);
}
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;
SnaccExcep::throwMe(-113);
}
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;
SnaccExcep::throwMe(-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);
a.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-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);
bb.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-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);
c.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-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);
x1Plus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-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);
x1Minus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-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);
cOrderPlus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-120);
}
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;
SnaccExcep::throwMe(-121);
}
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;
SnaccExcep::throwMe(-122);
}
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;
SnaccExcep::throwMe(-123);
}
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;
SnaccExcep::throwMe(-124);
}
else
return;
}
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;
SnaccExcep::throwMe(-125);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
DSAAlgorithmId::DSAAlgorithmId()
{
#if TCL
params = new DSABsafeParams;
#else
params = NULL; #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();
#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;
}
void DSAAlgorithmId::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-126);
}
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;
SnaccExcep::throwMe(-127);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-128);
}
else
return;
}
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;
SnaccExcep::throwMe(-129);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
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();
#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;
}
void FEEElGamalSignature::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-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);
pmX.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-131);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-132);
}
else
return;
}
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;
SnaccExcep::throwMe(-133);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
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();
#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;
}
void FEEECDSASignature::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-134);
}
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;
SnaccExcep::throwMe(-135);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-136);
}
else
return;
}
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;
SnaccExcep::throwMe(-137);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
FEEPublicKey::FEEPublicKey()
{
#if TCL
curveParams = new FEECurveParameters;
#else
curveParams = NULL; #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();
#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;
}
void FEEPublicKey::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-138);
}
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;
SnaccExcep::throwMe(-139);
}
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;
SnaccExcep::throwMe(-140);
}
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;
SnaccExcep::throwMe(-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);
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;
SnaccExcep::throwMe(-142);
}
else
return;
}
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;
SnaccExcep::throwMe(-143);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
FEEPrivateKey::FEEPrivateKey()
{
#if TCL
curveParams = new FEECurveParameters;
#else
curveParams = NULL; #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();
#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;
}
void FEEPrivateKey::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-144);
}
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;
SnaccExcep::throwMe(-145);
}
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;
SnaccExcep::throwMe(-146);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-147);
}
else
return;
}
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;
SnaccExcep::throwMe(-148);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
DSAPrivateKey::DSAPrivateKey()
{
#if TCL
dsaAlg = new DSAAlgorithmId;
#else
dsaAlg = NULL; #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();
#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;
}
void DSAPrivateKey::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-149);
}
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;
SnaccExcep::throwMe(-150);
}
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;
SnaccExcep::throwMe(-151);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-152);
}
else
return;
}
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;
SnaccExcep::throwMe(-153);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
DSAPublicKey::DSAPublicKey()
{
#if TCL
dsaAlg = new DSAAlgorithmId;
#else
dsaAlg = NULL; #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();
#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;
}
void DSAPublicKey::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-154);
}
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;
SnaccExcep::throwMe(-155);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-156);
}
else
return;
}
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;
SnaccExcep::throwMe(-157);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
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();
#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;
}
void DSAPrivateKeyOcts::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-158);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-159);
}
else
return;
}
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;
SnaccExcep::throwMe(-160);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
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();
#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;
}
void DSASignature::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-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);
s.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-162);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-163);
}
else
return;
}
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;
SnaccExcep::throwMe(-164);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
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();
#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;
}
void DSAAlgParams::BDecContent (BUF_TYPE b, AsnTag , 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;
SnaccExcep::throwMe(-165);
}
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;
SnaccExcep::throwMe(-166);
}
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;
SnaccExcep::throwMe(-167);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-168);
}
else
return;
}
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;
SnaccExcep::throwMe(-169);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
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
}
DHPrivateKey::DHPrivateKey()
{
#if TCL
params = new DHParameter;
#else
params = NULL; #endif // TCL
}
DHPrivateKey::DHPrivateKey (const DHPrivateKey &)
{
Asn1Error << "use of incompletely defined DHPrivateKey::DHPrivateKey (const DHPrivateKey &)" << endl;
abort();
}
DHPrivateKey::~DHPrivateKey()
{
delete params;
}
AsnType *DHPrivateKey::Clone() const
{
return new DHPrivateKey;
}
AsnType *DHPrivateKey::Copy() const
{
return new DHPrivateKey (*this);
}
#if SNACC_DEEP_COPY
DHPrivateKey &DHPrivateKey::operator = (const DHPrivateKey &that)
#else // SNACC_DEEP_COPY
DHPrivateKey &DHPrivateKey::operator = (const DHPrivateKey &)
#endif // SNACC_DEEP_COPY
{
#if SNACC_DEEP_COPY
if (this != &that)
{
dHOid = that.dHOid;
if (that.params)
{
if (!params)
params = new DHParameter;
*params = *that.params;
}
else
{
delete params;
params = NULL;
}
secretPart = that.secretPart;
}
return *this;
#else // SNACC_DEEP_COPY
Asn1Error << "use of incompletely defined DHPrivateKey &DHPrivateKey::operator = (const DHPrivateKey &)" << endl;
abort();
#endif // SNACC_DEEP_COPY
}
AsnLen
DHPrivateKey::BEncContent (BUF_TYPE b)
{
AsnLen totalLen = 0;
AsnLen l;
l = secretPart.BEncContent (b);
l += BEncDefLen (b, l);
l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
totalLen += l;
BEncEocIfNec (b);
l = params->BEncContent (b);
l += BEncConsLen (b, l);
l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
totalLen += l;
l = dHOid.BEncContent (b);
l += BEncDefLen (b, l);
l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE);
totalLen += l;
return totalLen;
}
void DHPrivateKey::BDecContent (BUF_TYPE b, AsnTag , 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);
dHOid.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-170);
}
if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
{
elmtLen1 = BDecLen (b, seqBytesDecoded, env);
params = new DHParameter;
params->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-171);
}
if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
|| (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
{
elmtLen1 = BDecLen (b, seqBytesDecoded, env);
secretPart.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-172);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-173);
}
else
return;
}
AsnLen DHPrivateKey::BEnc (BUF_TYPE b)
{
AsnLen l;
l = BEncContent (b);
l += BEncConsLen (b, l);
l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
return l;
}
void DHPrivateKey::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 << "DHPrivateKey::BDec: ERROR - wrong tag" << endl;
SnaccExcep::throwMe(-174);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
void DHPrivateKey::Print (ostream &os) const
{
#ifndef NDEBUG
os << "{ -- SEQUENCE --" << endl;
indentG += stdIndentG;
{
Indent (os, indentG);
os << "dHOid ";
os << dHOid;
os << "," << endl;
}
if (NOT_NULL (params))
{
Indent (os, indentG);
os << "params ";
os << *params;
}
else
{
Indent (os, indentG);
os << "params ";
os << "-- void --";
os << "," << endl;
}
{
Indent (os, indentG);
os << "secretPart ";
os << secretPart;
}
os << endl;
indentG -= stdIndentG;
Indent (os, indentG);
os << "}";
#endif
}
DHParameterBlock::DHParameterBlock()
{
#if TCL
params = new DHParameter;
#else
params = NULL; #endif // TCL
}
DHParameterBlock::DHParameterBlock (const DHParameterBlock &)
{
Asn1Error << "use of incompletely defined DHParameterBlock::DHParameterBlock (const DHParameterBlock &)" << endl;
abort();
}
DHParameterBlock::~DHParameterBlock()
{
delete params;
}
AsnType *DHParameterBlock::Clone() const
{
return new DHParameterBlock;
}
AsnType *DHParameterBlock::Copy() const
{
return new DHParameterBlock (*this);
}
#if SNACC_DEEP_COPY
DHParameterBlock &DHParameterBlock::operator = (const DHParameterBlock &that)
#else // SNACC_DEEP_COPY
DHParameterBlock &DHParameterBlock::operator = (const DHParameterBlock &)
#endif // SNACC_DEEP_COPY
{
#if SNACC_DEEP_COPY
if (this != &that)
{
oid = that.oid;
if (that.params)
{
if (!params)
params = new DHParameter;
*params = *that.params;
}
else
{
delete params;
params = NULL;
}
}
return *this;
#else // SNACC_DEEP_COPY
Asn1Error << "use of incompletely defined DHParameterBlock &DHParameterBlock::operator = (const DHParameterBlock &)" << endl;
abort();
#endif // SNACC_DEEP_COPY
}
AsnLen
DHParameterBlock::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 = oid.BEncContent (b);
l += BEncDefLen (b, l);
l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE);
totalLen += l;
return totalLen;
}
void DHParameterBlock::BDecContent (BUF_TYPE b, AsnTag , 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);
oid.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
tag1 = BDecTag (b, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-175);
}
if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
{
elmtLen1 = BDecLen (b, seqBytesDecoded, env);
params = new DHParameter;
params->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
}
else
{
Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
SnaccExcep::throwMe(-176);
}
bytesDecoded += seqBytesDecoded;
if (elmtLen0 == INDEFINITE_LEN)
{
BDecEoc (b, bytesDecoded, env);
return;
}
else if (seqBytesDecoded != elmtLen0)
{
Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
SnaccExcep::throwMe(-177);
}
else
return;
}
AsnLen DHParameterBlock::BEnc (BUF_TYPE b)
{
AsnLen l;
l = BEncContent (b);
l += BEncConsLen (b, l);
l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
return l;
}
void DHParameterBlock::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 << "DHParameterBlock::BDec: ERROR - wrong tag" << endl;
SnaccExcep::throwMe(-178);
}
elmtLen1 = BDecLen (b, bytesDecoded, env);
BDecContent (b, tag, elmtLen1, bytesDecoded, env);
}
void DHParameterBlock::Print (ostream &os) const
{
#ifndef NDEBUG
os << "{ -- SEQUENCE --" << endl;
indentG += stdIndentG;
{
Indent (os, indentG);
os << "oid ";
os << oid;
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
}