SignatureProvider.VerifyXmlDsig method (Office)

Verifies a signature based on the signed state of the document and the legitimacy of the certificate used for signing.

Syntax

expression.VerifyXmlDsig(QueryContinue, psigsetup, psiginfo, XmlDsigStream, pcontverres, pcertverres)

expression An expression that returns a SignatureProvider object.

Parameters

Name Required/Optional Data type Description
QueryContinue Required IQueryContinue Provides a way to query the host application for permission to continue the verification operation.
psigsetup Required SignatureSetup Specifies configuration information about a signature line.
psiginfo Required SignatureInfo Specifies information captured from the signing ceremony.
XmlDsigStream Required IStream Represents a stream of data containing XML, which represents an XMLDSIG object.
pcontverres Required ContentVerificationResults Specifies the status of the signature verification action.
pcertverres Required CertificateVerificationResults Specifies the status of the signing certificate verification.

Remarks

XMLDSIG is a standards-based signature format, verifiable by third parties. This is the default format for signatures in Microsoft Office.

Example

The following example, written in C#, shows the implementation of the VerifyXmlDsig method in a custom signature provider project.

 public void VerifyXmlDsig(object queryContinue, SignatureSetup sigsetup, SignatureInfo siginfo, object xmldsigStream, ref ContentVerificationResults contverresults, ref CertificateVerificationResults certverresults) 
 { 
 using (COMStream comstream = new COMStream(xmldsigStream)) 
 { 
 XmlDocument xmldsig = new XmlDocument(); 
 xmldsig.PreserveWhitespace = true; 
 xmldsig.Load(comstream); 
 
 XmlElement signature = xmldsig.DocumentElement; 
 SignedXml signedXml = new SignedXml(); 
 signedXml.LoadXml(signature); 
 
 contverresults = signedXml.CheckSignature() ? 
 Microsoft.Office.Core.ContentVerificationResults.contverresValid : 
 Microsoft.Office.Core.ContentVerificationResults.contverresModified; 
 } 
 }

Note

Signature providers are implemented exclusively in custom COM add-ins created in managed and unmanaged code and cannot be implemented in Microsoft Visual BasicĀ® for Applications (VBA).

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.