Edit

Share via


Signature Class

Definition

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

public ref class Signature abstract
public abstract class Signature
type Signature = class
Public MustInherit Class Signature
Inheritance
Signature

Examples

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.

// Get signature.
Signature mySignature = this.SignedDataBlocks[0].Signatures[0];

// Get status of signature.
string sigStatus = mySignature.Status.ToString();

// Get comment.
string signatureComment = mySignature.Comment;

// Get certificate used to sign with.
Certificate signatureCertificate = mySignature.Certificate;

// Get XML node that contains the signature.
XPathNavigator signatureNode = mySignature.SignatureBlockXmlNode;

// Display properties.
MessageBox.Show("Signature properties:\n\nStatus: " + sigStatus + 
   "\nComment: " + signatureComment + 
   "\nCertificate Issued To: " + signatureCertificate.IssuedTo);

// Display XML node subtree that contains signature.
MessageBox.Show("Digital signature XML block: \n" + signatureNode.InnerXml);
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 & _
   signatureNode.InnerXml)

Remarks

Use the Item[Int32] 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.

Constructors

Signature()

Properties

Certificate

Gets the Certificate object that represents the X.509 digital certificate that was used to sign a form or a set of signed data in a form.

Comment

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

SignatureBlockXmlNode

Gets a System.Xml.XPathNavigator object positioned at the XML node that contains a digital signature.

Status

Gets a SignatureStatus value that specifies the status of the associated digital signature.

Methods

Sign()

Writes the XML digital signature block and computes the cryptographic hash for the signed data.

Applies to