Exemplo n.º 1
0
        public X509Certificate2 GetCertificateAsX509Certificate2()
        {
            if (this._disposed)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            return(CertUtils.ToDotNetObject(GetSigningCertificate()));
        }
Exemplo n.º 2
0
        public Org.BouncyCastle.X509.X509Certificate GetCertificateAsX509Certificate()
        {
            if (this._disposed)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            return(CertUtils.ToBouncyCastleObject(GetSigningCertificate()));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Checks whether specified certificate matches this private key
        /// </summary>
        /// <param name="certificate">Certificate to be checked</param>
        /// <returns>Null if match cannot be performed, true if certificate matches, false otherwise</returns>
        public bool?Matches(X509Certificate2 certificate)
        {
            if (certificate == null)
            {
                return(null);
            }

            return(Matches(CertUtils.ToBouncyCastleObject(certificate)));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Checks whether specified certificate matches this certificate
        /// </summary>
        /// <param name="certificate">Certificate to be checked</param>
        /// <returns>Null if match cannot be performed, true if certificate matches, false otherwise</returns>
        public bool?Matches(BCX509.X509Certificate certificate)
        {
            if (certificate == null)
            {
                return(null);
            }

            return(certificate.Equals(CertUtils.ToBouncyCastleObject(this.Data)));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Intitializes class instance
        /// </summary>
        /// <param name="id">Hex encoded string with identifier (value of CKA_ID attribute) of the certificate</param>
        /// <param name="label">Label (value of CKA_LABEL attribute) of the certificate</param>
        /// <param name="data">DER encoded certificate data (value of CKA_VALUE attribute)</param>
        internal Certificate(string id, string label, byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            BCX509.X509Certificate cert = CertUtils.ToBouncyCastleObject(data);

            _id        = id;
            _label     = label;
            _data      = data;
            _publicKey = cert.GetPublicKey();
        }