Freigeben über


getVerifyingCertificateContext Method

 

[This sample code uses features that were implemented in MSXML 5.0 for Microsoft Office Applications. XML digital signatures are not supported in MXSML 6.0 and later.]

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

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 for Microsoft Office Applications and later

See Also

getVerifyingCertificate Method