Opc.Ua.Win32.CryptVerifyCertificateSignature C# (CSharp) Method

CryptVerifyCertificateSignature() private method

private CryptVerifyCertificateSignature ( IntPtr hCryptProv, Int32 dwCertEncodingType, IntPtr pbEncoded, Int32 cbEncoded, CERT_PUBLIC_KEY_INFO &pPublicKey ) : int
hCryptProv System.IntPtr
dwCertEncodingType System.Int32
pbEncoded System.IntPtr
cbEncoded System.Int32
pPublicKey CERT_PUBLIC_KEY_INFO
return int
        public static extern int CryptVerifyCertificateSignature(
          IntPtr hCryptProv,
          Int32 dwCertEncodingType,
          IntPtr pbEncoded,
          Int32 cbEncoded,
          ref CERT_PUBLIC_KEY_INFO pPublicKey);

Usage Example

コード例 #1
0
ファイル: X509CRL.cs プロジェクト: benvert/pfe
        /// <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);
        }