Signature class

Office 2013 and later

Represents a digital signature that has been added to a form or a set of signed data in a form.


Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Public MustInherit Class Signature
Dim instance As Signature

Use the Item property of the SignatureCollection collection to return a Signature object.

The Signature class provides the Sign method for writing the XML digital signature block and computing the cryptographic hash for the signed data.

The Signature class provides the following properties for retrieving information about the digital signature:

  • Certificate   Gets the Certificate object for the X.509 digital certificate with which the form user signed a form or a set of data in a form.

  • Comment   Gets the comment the user added to the digital signature that the user associated with a form or a set of data in a form.

  • SignatureBlockXmlNode   Gets the XML node that contains a digital signature. You can use this property to extend the signature properties or the set of data that InfoPath stores with the signature.

  • Status   Gets the status of the specified digital signature as a SignatureStatus enumeration value.

The following example displays information about the first digital signature for the first set of signed data in a form (or if the form template is configured to sign the entire form, information about the first signature for the entire form). First, a reference to the Signature object that represents the signature is retrieved. The Status and Comment properties of the Signature class are used to get the status and comment values from the signature. The Certificate property of the Signature class is used to get the Certificate object of the signature, which is later used to display who the certificate was issued to. The SignatureBlockXmlNode property of the Signature class is used to retrieve the XML node subtree that contains the signature information. Finally, all of this information is displayed in a series of message boxes.

Imports Microsoft.VisualBasic.Constants
' Get signature.
Dim mySignature As Signature = Me.SignedDataBlocks(0).Signatures(0)

' Get status of signature.
Dim sigStatus As String = mySignature.Status.ToString()

' Get comment.
Dim signatureComment As String = mySignature.Comment

' Get certificate used to sign with.
Dim signatureCertificate As Certificate = mySignature.Certificate

' Get XML node that contains the signature.
Dim signatureNode As XPathNavigator = mySignature.SignatureBlockXmlNode

' Display properties.
MessageBox.Show("Signature properties:" & NewLine & _
   "Status: " & sigStatus & NewLine & _
   "Comment: " & signatureComment & NewLine & _
   "Certificate Issued To: " & signatureCertificate.IssuedTo)

' Display XML node subtree that contains signature.
MessageBox.Show("Digital signature XML block:" & NewLine & _

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.