This documentation is archived and is not being maintained.

XpsDocument::SignDigitally Method (X509Certificate, Boolean, XpsDigSigPartAlteringRestrictions, Guid, Boolean)

Signs a collection of package parts with a specified X.509 certificate.

Namespace:  System.Windows.Xps.Packaging
Assembly:  ReachFramework (in ReachFramework.dll)

public:
XpsDigitalSignature^ SignDigitally(
	X509Certificate^ certificate, 
	bool embedCertificate, 
	XpsDigSigPartAlteringRestrictions restrictions, 
	Guid id, 
	bool testIsSignable
)

Parameters

certificate
Type: System.Security.Cryptography.X509Certificates::X509Certificate
The X.509 certificate to use in signing each part; or nullptr to prompt the user to select an installed certificate.
embedCertificate
Type: System::Boolean
true to store the certificate in the package; otherwise, false.
restrictions
Type: System.Windows.Xps.Packaging::XpsDigSigPartAlteringRestrictions
Flags that indicate what dependent parts to exclude from the signing.
id
Type: System::Guid
The ID to assign to the signature.
testIsSignable
Type: System::Boolean
true to verify that IsSignable is true before signing; otherwise, false.

Return Value

Type: System.Windows.Xps.Packaging::XpsDigitalSignature
An XpsDigitalSignature that contains information about the signature.

If certificate is nullptr, a dialog box is presented that enables the user to select an installed X.509 certificate, such as from a smart card reader.

CryptographicException is thrown if certificate is nullptr and no certificates are installed.

The following example shows how to use the SignDigitally method.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: