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 void Decode(Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength) { var tag = new Asn1Tag(); buffer.Mark(); var num = buffer.DecodeTagAndLength(tag); if (tag.Equals(0, 0, NullTypeCode)) { buffer.Reset(); var element = new NullParams(); SetElement(Null, element); Element.Decode(buffer, true, num); } else { if (!tag.Equals(0, 0x20, SequenceTypeCode)) { throw ExceptionUtility.CryptographicException(Resources.Asn1InvalidChoiceOptionTagException, tag, buffer.ByteCount); } buffer.Reset(); var parameters = new GostR341094PublicKeyParameters(); SetElement(Params, parameters); Element.Decode(buffer, true, num); } }
public override void Decode(Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength) { var tag = new Asn1Tag(); buffer.Mark(); var num = buffer.DecodeTagAndLength(tag); if (tag.Equals(0, 0, NullTypeCode)) { buffer.Reset(); SetElement(Null, new NullParams()); Element.Decode(buffer, true, num); } else { if (!tag.Equals(0, TagForm, TagIdCode)) { throw ExceptionUtility.CryptographicException(Resources.Asn1InvalidChoiceOptionTagException, tag, buffer.ByteCount); } buffer.Reset(); SetElement(Params, CreateParams()); Element.Decode(buffer, true, num); } }
public virtual bool Expired() { if (_elemLength == Asn1Status.IndefiniteLength) { var parsedLen = new IntHolder(); var flag = _decodeBuffer.MatchTag(0, 0, 0, null, parsedLen); if (flag) { _decodeBuffer.Reset(); } return(flag); } var num = _decodeBuffer.ByteCount - _decBufByteCount; return(num >= _elemLength); }