Partager via


CertVerifySubjectCertificateContext

This function performs the enabled verification checks on a certificate by checking the validity of the certificate's issuer. The new certificate chain verification functions are recommended instead this function.

BOOL WINAPI CertVerifySubjectCertificateContext(
  PCCERT_CONTEXT pSubject, 
  PCCERT_CONTEXT pIssuer, 
  DWORD* pdwFlags
);

Parameters

  • pSubject
    [in] Pointer to a CERT_CONTEXT structure containing the subject's certificate.

  • pIssuer
    [in] Optional. Pointer to a CERT_CONTEXT structure containing the issuer's certificate. When checking just CERT_STORE_TIME_VALIDITY_FLAG, the pIssuer parameter can be NULL.

  • pdwFlags
    [in, out] On input, pointer to a DWORD that contains verification check flags. The following table shows flags that can be set to enable verification checks on the subject certificate. The flags can be combined using a bitwise OR operation to enable multiple verifications.

    Value Description
    CERT_STORE_SIGNATURE_FLAG Uses the public key in the issuer's certificate to verify the signature on the subject certificate.
    CERT_STORE_TIME_VALIDITY_FLAG Gets the current time and verifies that it is within the subject certificate's validity period.

    If an enabled verification check succeeds, its flag is set to zero. If it fails, then its flag is set on output.

    If CERT_STORE_REVOCATION_FLAG is enabled and the issuer does not have a CRL in the store, then CERT_STORE_NO_CRL_FLAG is set in addition to CERT_STORE_REVOCATION_FLAG.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE.

For a verification check failure, TRUE is still returned. FALSE is returned only when a bad parameter is passed in.

For extended error information, call the GetLastError function. The GetLastError function can return E_INVALIDARG, which means that an unsupported bit was set in the pdwFlags parameter. Any combination of CERT_STORE_SIGNATURE_FLAG, CERT_STORE_TIME_VALIDITY_FLAG, and CERT_STORE_REVOCATION_FLAG can be set. If the pIssuer parameter is NULL, only CERT_STORE_TIME_VALIDITY_FLAG can be set.

Remarks

The hexadecimal value of the flags can be combined using bitwise OR operations to enable multiple verifications. For example, to enable both signature and time validity, place the CERT_STORE_SIGNATURE_FLAG | CERT_STORE_TIME_VALIDITY_FLAG value in the pdwFlagsDWORD as an input parameter. If CERT_STORE_SIGNATURE_FLAG verification succeeds, but CERT_STORE_TIME_VALIDITY_FLAG verification fails, the pdwFlags parameter is set to CERT_STORE_TIME_VALIDITY_FLAG when the function returns.

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Wincrypt.h.
Link Library: Crypt32.lib.

See Also

CertGetCertificateChain | CertGetIssuerCertificateFromStore | CERT_CONTEXT

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.