Freigeben über


getVerifyingCertificate 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 associated with this key used to verify a signature.

JScript Syntax

var oCertificate = IXMLDSigKeyEx.getVerifyingCertificate();  

Visual Basic Syntax

Set oCertificate = IXMLDSigKeyEx.getVerifyingCertificate  

C/C++ Syntax

HRESULT getVerifyingCertificate (IUnknown** oCertificate);  

C/C++ Syntax Using Smart Pointers

IUnknownPtr oCertificate = IXMLDSigKeyEx.getVerifyingCertificate();  

Parameters

oCertificate
In C/C++ applications not using smart pointer classes, this is a reference to the certificate associated with the key. In all other cases, this is the certificate of the key.

Return Values

S_OK
The method call was successful.

E_FAIL
The method call failed.

Remarks

You must call this method after a signature is verified.

If the signature contains a certificate, this method returns the certificate of the key. If the signature contains no certificate, the resultant oCertificate parameter is NULL.

Example

The following example demonstrates how to validate the certificate used in the signature verification. A signed signature document containing a certificate is first verified before the certificate is validated by examining the root certificate. In any production code, a more sophisticated validation procedure should be followed.

The signed signature document is used as the input for the code examples in C/C++, JScript, and Visual Basic. The output is the same in each language.

Applies to

IXMLDigitalSignature, IXMLDigitalSignatureEx

Versioning

MSXML 5.0 for Microsoft Office Applications and later