Ejemplo n.º 1
0
        public void AddDecryptingToken(X509Certificate2 certificate)
        {
            Requires.NotNull(certificate, "certificate");
            Requires.That(certificate.HasPrivateKey, "certificate", "requires private key");
            var cert = new X509SecurityToken(certificate);

            try {
                this.AddDecryptingToken(cert);
            } catch {
                cert.Dispose();
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds an X.509 certificate with a private key that may be used to decrypt the incoming token.
        /// </summary>
        /// <param name="certificate">The certificate.</param>
        public void AddDecryptingToken(X509Certificate2 certificate)
        {
            Contract.Requires <ArgumentNullException>(certificate != null);
            Contract.Requires <ArgumentException>(certificate.HasPrivateKey);
            var cert = new X509SecurityToken(certificate);

            try {
                this.AddDecryptingToken(cert);
            } catch {
                cert.Dispose();
                throw;
            }
        }
Ejemplo n.º 3
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         lock (_lock)
         {
             if (_securityToken != null)
             {
                 _securityToken.Dispose();
             }
             _x509Certificate = null;
         }
         _disposed = true;
     }
 }