示例#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, 0, 6, parsedLen, false))
            {
                throw ExceptionUtility.CryptographicException(Resources.Asn1MissingRequiredException, buffer.ByteCount);
            }

            _publicKeyParamSet = new Asn1ObjectIdentifier();
            _publicKeyParamSet.Decode(buffer, true, parsedLen.Value);

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

            _digestParamSet = new Asn1ObjectIdentifier();
            _digestParamSet.Decode(buffer, true, parsedLen.Value);

            if (context.MatchElemTag(0, 0, 6, parsedLen, false))
            {
                _encryptionParamSet = new Gost2814789ParamSet();
                _encryptionParamSet.Decode(buffer, true, parsedLen.Value);
            }
        }
示例#2
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, 0, ObjectIdentifierTypeCode, parsedLen, false))
            {
                throw new Exception("Asn1MissingRequiredException");
            }

            PublicKeyParamSet = new Asn1ObjectIdentifier();
            PublicKeyParamSet.Decode(buffer, true, parsedLen.Value);

            if (!context.MatchElemTag(0, 0, ObjectIdentifierTypeCode, parsedLen, false))
            {
                throw new Exception("Asn1MissingRequiredException");
            }

            DigestParamSet = new Asn1ObjectIdentifier();
            DigestParamSet.Decode(buffer, true, parsedLen.Value);

            if (context.MatchElemTag(0, 0, ObjectIdentifierTypeCode, parsedLen, false))
            {
                EncryptionParamSet = new Gost2814789ParamSet();
                EncryptionParamSet.Decode(buffer, true, 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, 0, ObjectIdentifierTypeCode, parsedLen, false))
            {
                throw ExceptionUtility.CryptographicException(Resources.Asn1MissingRequiredException, buffer.ByteCount);
            }

            EncryptionParamSet = new Gost2814789ParamSet();
            EncryptionParamSet.Decode(buffer, true, parsedLen.Value);

            if (context.MatchElemTag(0, 0, OctetStringTypeCode, parsedLen, false))
            {
                Ukm = new Asn1OctetString();
                Ukm.Decode(buffer, true, parsedLen.Value);

                if (Ukm.Length != 8)
                {
                    throw ExceptionUtility.CryptographicException(Resources.Asn1ConsVioException, "Ukm.Length", Ukm.Length);
                }
            }
        }
示例#4
0
 private void Init()
 {
     _publicKeyParamSet  = null;
     _digestParamSet     = null;
     _encryptionParamSet = null;
 }
示例#5
0
 private void Init()
 {
     DigestParamSet     = null;
     PublicKeyParamSet  = null;
     EncryptionParamSet = null;
 }
示例#6
0
 private void Init()
 {
     EncryptionParamSet = null;
     EphemeralPublicKey = null;
     Ukm = null;
 }
 private void Init()
 {
     EncryptionParamSet = null;
     Ukm = null;
 }