getVerifyingCertificateContext Method

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - Digital Signatures

getVerifyingCertificateContext Method

[This feature was first implemented for MSXML 5.0.]

Retrieves the certificate context associated with this key used to verify a signature.

[C/C++]

C/C++ Syntax

HRESULT getVerifyingCertificateContext (void** pCertContext);

C/C++ Syntax Using Smart Pointers

void *pCertContext = oIXMLDSigEx.getVerifyingCertificateContext();

Parameters

pCertContext
In C/C++ application without using smart pointers, this is the reference to the context of the certificate of this key that has been used to verify a signature. In the other case, this is the context of the certificate of this key that has been used to verify a signature.

Return Values

S_OK
Operation was successful.
E_FAIL
Operation failed.

Remarks

You can call this method after a signature is verified.

To use the resultant certificate context, type cast it to the PCCERT_CONTEXT type. After using the certificate context, it is your responsibility to free the context by calling CertFreeCertificateContext function of CryptoAPI.

Example

The following example demonstrates how to validate the certificate of the key used in the signature verification. A signed signature document containing a certificate is first verified before the certificate is validated by building its chain. If the trust chain is built without errors, the certificate is deemed valid. In any production code, more sophisticated validation criteria might be necessary.

Applies To

IXMLDigitalSignatureEx

Versioning

MSXML 5.0 and later

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

getVerifyingCertificate Method