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++ 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.
- The resource file is a signed signature document as listed in Resource Files (signature_signed.rsa.cert.xml).
- C/C++ Code (getVerifyingCert.cpp)
- Output for the getVerifyingCertificate Method Example
Applies To
Versioning
MSXML 5.0 and later
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
See Also
getVerifyingCertificate Method