Example #1
0
        public override void Decode(Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
        {
            var elemLength = explicitTagging ? MatchTag(buffer, Asn1Tag.Sequence) : implicitLength;

            Init();

            var context   = new Asn1BerDecodeContext(buffer, elemLength);
            var parsedLen = new IntHolder();

            if (!context.MatchElemTag(0, 0x20, SequenceTypeCode, parsedLen, false))
            {
                throw ExceptionUtility.CryptographicException(Resources.Asn1MissingRequiredException, buffer.ByteCount);
            }

            SessionEncryptedKey = new Gost2814789EncryptedKey();
            SessionEncryptedKey.Decode(buffer, true, parsedLen.Value);

            if (context.MatchElemTag(0x80, 0x20, EocTypeCode, parsedLen, true))
            {
                TransportParameters = new GostR3410TransportParameters();
                TransportParameters.Decode(buffer, false, parsedLen.Value);
            }
        }
        public override void Decode(Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
        {
            var elemLength = explicitTagging ? MatchTag(buffer, Asn1Tag.Sequence) : implicitLength;

            Init();

            var context = new Asn1BerDecodeContext(buffer, elemLength);
            var parsedLen = new IntHolder();

            if (!context.MatchElemTag(0, 0x20, SequenceTypeCode, parsedLen, false))
            {
                throw ExceptionUtility.CryptographicException(Resources.Asn1MissingRequiredException, buffer.ByteCount);
            }

            SessionEncryptedKey = new Gost2814789EncryptedKey();
            SessionEncryptedKey.Decode(buffer, true, parsedLen.Value);

            if (context.MatchElemTag(0x80, 0x20, EocTypeCode, parsedLen, true))
            {
                TransportParameters = new GostR3410TransportParameters();
                TransportParameters.Decode(buffer, false, parsedLen.Value);
            }
        }
Example #3
0
 private void Init()
 {
     SessionEncryptedKey = null;
     TransportParameters = null;
 }
 private void Init()
 {
     SessionEncryptedKey = null;
     TransportParameters = null;
 }