Пример #1
0
        public EncryptedNewKeySignedXmlCipher(
            X509Certificate2 exchangeCertificate = null,
            X509Certificate2 signCertificate     = null,
            string symmetricAlgorithmName        = null,
            string hashAlgorithmName             = null)
            : base(exchangeCertificate, symmetricAlgorithmName)
        {
            if (signCertificate == null)
            {
                throw new ArgumentNullException(nameof(signCertificate));
            }

            _signer = new RsaXmlSigner(signCertificate, hashAlgorithmName)
            {
                SignatureLocation = SignatureLocation.Enveloped,
            };
        }
Пример #2
0
        public EncryptedNewKeySignedXmlCipher(
            X509Certificate2 exchangeCertificate = null,
            X509Certificate2 signCertificate     = null,
            string symmetricAlgorithmName        = null,
            string hashAlgorithmName             = null)
            : base(exchangeCertificate, symmetricAlgorithmName)
        {
            if (signCertificate == null)
            {
                try
                {
                    signCertificate = ServiceLocatorWrapper.Default.GetInstance <X509Certificate2>(Algorithms.Hash.CertificateResolveName);
                }
                catch (ActivationException x)
                {
                    throw new ArgumentNullException("The argument \"signCertificate\" was null and could not be resolved from the Common Service Locator.", x);
                }
            }

            _signer = new RsaXmlSigner(signCertificate, hashAlgorithmName)
            {
                SignatureLocation = SignatureLocation.Enveloped,
            };
        }