Signature.Sign Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes the XML digital signature block and computes the cryptographic hash for the signed data.
public:
abstract void Sign();
public abstract void Sign ();
abstract member Sign : unit -> unit
Public MustOverride Sub Sign ()
Exceptions
Form code attempted to write to the underlying XML document after signing was initiated.
The form template is not configured for Full Trust using the Security and Trust category of the Form Options dialog box.
Examples
The following example shows the code skeleton that is added to the form template when you add an event handler for the Sign event. First, it uses the CreateSignature() method of the SignatureCollection class to create a new Signature object. It then calls the Sign method of the Signature class to add the new Signature object to the SignatureCollection object of the form without displaying the Digital Signatures dialog box.
public void FormEvents_Sign(object sender, SignEventArgs e)
{
// This event handler will run only in fully trusted form templates.
Signature thisSignature =
e.SignedDataBlock.Signatures.CreateSignature();
// To add other pieces of information to sign, modify the
// signature template returned by
// thisSignature.SignatureBlockXmlNode.
// Write your code here.
thisSignature.Sign();
e.SignatureWizard = false;
}
Public Sub FormEvents_Sign(ByVal sender As Object, _
ByVal e As SignEventArgs)
' This event handler will run only in fully trusted form templates.
Dim thisSignature As Signature = _
e.SignedDataBlock.Signatures.CreateSignature()
' To add other pieces of information to sign, modify the
' signature template returned by
' thisSignature.SignatureBlockXmlNode.
' Write your code here.
thisSignature.Sign()
e.SignatureWizard = False
End Sub
Remarks
The Sign method can only be called from an event handler for the Sign event.
This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.
This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.