Skip to content

NetSSL_Win certificate verification failure when intermediate certificates are not available in the Windows trusted store #3907

@bhatkarthik

Description

@bhatkarthik

if (!CertGetCertificateChain(

  • Poco is passing the hAdditionalStore parameter as null when calling CertGetCertificateChain.
  • When the intermediate certificates are not installed on the machine, looks like hCertStore of the CERT_CONTEXT member needs to be passed as hAdditionalStore parameter to CertGetCertificateChain, for it to be able to build the entire chain.
  • Without this, the created certificate chain seems to contain only the leaf certificate and thus the certificate validation fails
    • It fails to find the back of the chain (in this case leaf itself), in the certificate store.
    • PCCERT_CONTEXT pResult = CertFindCertificateInStore(trustedCerts, certs.back()->dwCertEncodingType, 0, CERT_FIND_ISSUER_OF, certs.back(), 0);
  • Windows (Schannel) gives the handle to the store containing intermediate certificates under hCertStore memeber of CERT_CONTEXT certificate obtained from QueryContextAttributes (Schannel)

Note:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions