/// <summary>
 /// Creates a new instance of <see cref="RsaSignatureCookieTransform"/>
 /// </summary>
 /// <param name="certificate">Certificate whose private key is used to sign and verify.</param>
 /// <exception cref="ArgumentNullException">When certificate is null.</exception>
 /// <exception cref="ArgumentException">When the certificate has no private key.</exception>
 /// <exception cref="ArgumentException">When the certificate's key is not RSA.</exception>
 public RsaSignatureCookieTransform(X509Certificate2 certificate)
 {
     if (null == certificate)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("certificate");
     }
     _signingKey = X509Util.EnsureAndGetPrivateRSAKey(certificate);
     _verificationKeys.Add(_signingKey);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of <see cref="RsaEncryptionCookieTransform"/>
 /// </summary>
 /// <param name="certificate">Certificate whose private key is used to encrypt and decrypt.</param>
 /// <exception cref="ArgumentNullException">When certificate is null.</exception>
 /// <exception cref="ArgumentException">When the certificate has no private key.</exception>
 /// <exception cref="ArgumentException">When the certificate's key is not RSA.</exception>
 public RsaEncryptionCookieTransform(X509Certificate2 certificate)
 {
     if (null == certificate)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("certificate");
     }
     _encryptionKey = X509Util.EnsureAndGetPrivateRSAKey(certificate);
     _decryptionKeys.Add(_encryptionKey);
 }