コード例 #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);
            }

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

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

            EncryptedParameters = new Gost2814789KeyWrapParameters();
            EncryptedParameters.Decode(buffer, true, parsedLen.Value);
        }
コード例 #2
0
 private void Init()
 {
     EncryptedKey = null;
     EncryptedParameters = null;
 }