Beispiel #1
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)));
        }
Beispiel #2
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)));
        }
Beispiel #3
0
        public Org.BouncyCastle.X509.X509Certificate GetCertificateAsX509Certificate()
        {
            if (this._disposed)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            return(CertUtils.ToBouncyCastleObject(GetSigningCertificate()));
        }
Beispiel #4
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();
        }