Exemplo n.º 1
0
        public void DecodeParameters(byte[] data)
        {
            if (data == null)
            {
                throw new Exception("ArgumentNull - data");
            }

            var asnDecoder          = new Asn1BerDecodeBuffer(data);
            var publicKeyParameters = new GostR34102001PublicKeyParameters();

            publicKeyParameters.Decode(asnDecoder);

            DigestParamSet     = Asn1ObjectIdentifier.ToOidString(publicKeyParameters.DigestParamSet);
            PublicKeyParamSet  = Asn1ObjectIdentifier.ToOidString(publicKeyParameters.PublicKeyParamSet);
            EncryptionParamSet = Asn1ObjectIdentifier.ToOidString(publicKeyParameters.EncryptionParamSet);
        }
        public void DecodeParameters(byte[] data)
        {
            if (data == null)
            {
                throw ExceptionUtility.ArgumentNull("data");
            }

            try
            {
                var asnDecoder          = new Asn1BerDecodeBuffer(data);
                var publicKeyParameters = new GostR34102001PublicKeyParameters();
                publicKeyParameters.Decode(asnDecoder);

                DigestParamSet     = Asn1ObjectIdentifier.ToOidString(publicKeyParameters.DigestParamSet);
                PublicKeyParamSet  = Asn1ObjectIdentifier.ToOidString(publicKeyParameters.PublicKeyParamSet);
                EncryptionParamSet = Asn1ObjectIdentifier.ToOidString(publicKeyParameters.EncryptionParamSet);
            }
            catch (Exception exception)
            {
                throw ExceptionUtility.CryptographicException(exception, Resources.Asn1DecodeError, typeof(GostR34102001PublicKeyParameters).FullName);
            }
        }