MimeKit.Cryptography.CmsSigner.CmsSigner C# (CSharp) Method

CmsSigner() public method

Initializes a new instance of the MimeKit.Cryptography.CmsSigner class.

The initial value of the DigestAlgorithm will be set to MimeKit.Cryptography.DigestAlgorithm.Sha1 and both the SignedAttributes and UnsignedAttributes properties will be initialized to empty tables.

/// is null. /// -or- /// is null. /// /// did not contain any certificates. /// -or- /// The certificate cannot be used for signing. /// -or- /// is not a private key. ///
public CmsSigner ( IEnumerable chain, AsymmetricKeyParameter key ) : System
chain IEnumerable The chain of certificates starting with the signer's certificate back to the root.
key Org.BouncyCastle.Crypto.AsymmetricKeyParameter The signer's private key.
return System
		public CmsSigner (IEnumerable<X509Certificate> chain, AsymmetricKeyParameter key) : this ()
		{
			if (chain == null)
				throw new ArgumentNullException ("chain");

			if (key == null)
				throw new ArgumentNullException ("key");

			CertificateChain = new X509CertificateChain (chain);

			if (CertificateChain.Count == 0)
				throw new ArgumentException ("The certificate chain was empty.", "chain");

			CheckCertificateCanBeUsedForSigning (CertificateChain[0]);

			if (!key.IsPrivate)
				throw new ArgumentException ("The key must be a private key.", "key");

			Certificate = CertificateChain[0];
			PrivateKey = key;
		}

Same methods

CmsSigner::CmsSigner ( ) : System
CmsSigner::CmsSigner ( System.Stream stream, string password ) : System
CmsSigner::CmsSigner ( System.Security.Cryptography.X509Certificates.X509Certificate2 certificate ) : System
CmsSigner::CmsSigner ( X509Certificate certificate, AsymmetricKeyParameter key ) : System
CmsSigner::CmsSigner ( string fileName, string password ) : System