public override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength) { int llen = implicitLength; // decode CHOICE Asn1Tag tag = new Asn1Tag(); buffer.Mark(); int len = buffer.DecodeTagAndLength(tag); if (tag.Equals(Asn1Tag.Universal, Asn1Tag.PRIM, 5)) { buffer.Reset(); NULLParams null_ = new NULLParams(); SetElement(_NULL_, null_); Element.Decode(buffer, true, len); } else if (tag.Equals(Asn1Tag.Universal, Asn1Tag.CONS, 16)) { buffer.Reset(); GostR3410_2012_PublicKeyParameters params_ = new GostR3410_2012_PublicKeyParameters(); SetElement(_PARAMS_, params_); Element.Decode(buffer, true, len); } else { throw new Exception("Asn1InvalidChoiceOptionException (buffer, tag)"); } }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { int _aal = 0, len; switch (ChoiceId) { // encode null_ case _NULL_: NULLParams null_ = (NULLParams)GetElement(); len = null_.Encode(buffer, true); _aal += len; break; // encode params_ case _PARAMS_: GostR3410_2012_PublicKeyParameters params_ = (GostR3410_2012_PublicKeyParameters)GetElement(); len = params_.Encode(buffer, true); _aal += len; break; default: throw new Exception("Asn1InvalidChoiceOptionException()"); } return(_aal); }
public void Set_null_(NULLParams value) { SetElement(_NULL_, value); }