Signature.Sign Method

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

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

Syntax

'Declaration
Sub Sign
'Usage
Dim instance As Signature

instance.Sign()
void Sign()

Remarks

The Sign method can only be called from the OnSign event. Calling this method advances the Digital Signatures Wizard to the second step in the signing process, selecting a certificate.

Important

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.

Examples

In the following example, created by adding the OnSign event to the form by selecting Programming from the Tools menu in the InfoPath designer user interface, a digital signature is added to the form by using the Sign method of the SignatureObject object:

public void OnSign(SignEvent e)
{
// The OnSign handler can be customized only in fully trusted form templates.
Signature thisSignature = e.SignedDataBlock.Signatures.Create();

// You can add other pieces of information to sign by modifying the signature
// template in thisSignature.SignatureBlockXmlNode.
thisSignature.Sign();
e.ReturnStatus = true;
}

See Also

Reference

Signature Interface

Signature Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace