iTextSharp.text.pdf.security.X509Certificate2Signature.X509Certificate2Signature C# (CSharp) Метод

X509Certificate2Signature() публичный Метод

Creates a signature using a X509Certificate2. It supports smartcards without exportable private keys.
public X509Certificate2Signature ( X509Certificate2 certificate, String hashAlgorithm ) : System
certificate System.Security.Cryptography.X509Certificates.X509Certificate2 The certificate with the private key
hashAlgorithm String The hash algorithm for the signature. As the Windows CAPI is used /// to do the signature the only hash guaranteed to exist is SHA-1
Результат System
        public X509Certificate2Signature(X509Certificate2 certificate, String hashAlgorithm) {
            if (!certificate.HasPrivateKey)
                throw new ArgumentException("No private key.");
            this.certificate = certificate;
            this.hashAlgorithm = DigestAlgorithms.GetDigest(DigestAlgorithms.GetAllowedDigests(hashAlgorithm));
            if (certificate.PrivateKey is RSACryptoServiceProvider)
                encryptionAlgorithm = "RSA";
            else if (certificate.PrivateKey is DSACryptoServiceProvider)
                encryptionAlgorithm = "DSA";
            else
                throw new ArgumentException("Unknown encryption algorithm " + certificate.PrivateKey);
        }