Пример #1
0
        /// <summary>
        /// Verifies the signature on the CRL.
        /// </summary>
        public bool VerifySignature(X509Certificate2 issuer, bool throwOnError)
        {
            Win32.CERT_CONTEXT context = (Win32.CERT_CONTEXT)Marshal.PtrToStructure(issuer.Handle, typeof(Win32.CERT_CONTEXT));
            Win32.CERT_INFO    info    = (Win32.CERT_INFO)Marshal.PtrToStructure(context.pCertInfo, typeof(Win32.CERT_INFO));

            int bResult = Win32.CryptVerifyCertificateSignature(
                IntPtr.Zero,
                Win32.X509_ASN_ENCODING,
                m_pBuffer,
                m_bufferSize,
                ref info.SubjectPublicKeyInfo);

            if (bResult == 0)
            {
                if (throwOnError)
                {
                    throw Win32.GetLastError(StatusCodes.BadCertificateInvalid, "Could not get verify signature on CRL.");
                }

                return(false);
            }

            m_issuer = issuer;
            return(true);
        }