XpsDigSigPartAlteringRestrictions Enum

Definition

Specifies the parts of the XPS Package that are excluded from the range of a digital signature.

This enumeration supports a bitwise combination of its member values.

public enum class XpsDigSigPartAlteringRestrictions
[System.Flags]
public enum XpsDigSigPartAlteringRestrictions
[<System.Flags>]
type XpsDigSigPartAlteringRestrictions = 
Public Enum XpsDigSigPartAlteringRestrictions
Inheritance
XpsDigSigPartAlteringRestrictions
Attributes

Fields

Annotations 2

The Annotations part is excluded.

CoreMetadata 1

The Core Properties part is excluded.

None 0

No parts are excluded.

SignatureOrigin 4

The Signature Origin part is excluded.

Examples

The following example shows how to use this enumeration to digitally sign an XPS document.


// ------------------------------ SignXps -----------------------------
/// <summary>
///   Signs an XPS document with a given X509 certificate, and if one
///   exists, associates the signature with a given SignatureDefintion
///   spotId GUID.</summary>
/// <param name="xpsDocument">
///   The XPS document to sign.</param>
/// <param name="cert">
///   The X509 certificate to use for signing.</param>
/// <param name="spotId">
///   The nullable spotId GUID of the signature definition.</param>
public void SignXps(
    XpsDocument xpsDocument, X509Certificate cert, Guid? spotId )
{
    // If there's a SignatureDefinition spotId,
    // associate it with the signature.
    if (spotId != null)
    {
        xpsDocument.SignDigitally(
            cert, true, XpsDigSigPartAlteringRestrictions.None,
            spotId.Value);
    }
    else
    {
        xpsDocument.SignDigitally(
            cert, true, XpsDigSigPartAlteringRestrictions.None);
    }
}// end:SignXps()

' ------------------------------ SignXps -----------------------------
''' <summary>
'''   Signs an XPS document with a given X509 certificate, and if one
'''   exists, associates the signature with a given SignatureDefintion
'''   spotId GUID.</summary>
''' <param name="xpsDocument">
'''   The XPS document to sign.</param>
''' <param name="cert">
'''   The X509 certificate to use for signing.</param>
''' <param name="spotId">
'''   The nullable spotId GUID of the signature definition.</param>
Public Sub SignXps(xpsDocument As XpsDocument, cert As X509Certificate, spotId? As Guid)
    ' If there's a SignatureDefinition spotId,
    ' associate it with the signature.
    If spotId IsNot Nothing Then
        xpsDocument.SignDigitally(cert, True, XpsDigSigPartAlteringRestrictions.None, spotId.Value)
    Else
        xpsDocument.SignDigitally(cert, True, XpsDigSigPartAlteringRestrictions.None)
    End If

End Sub

Remarks

This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.

Parts that are specified as excluded from the digital signature can be modified without invalidating the signature. For example, if a document is to be signed by more than one person, the SignatureOrigin part needs to be excluded from the signature when the document is first signed. (Exclusions are specified in the restrictions parameter of the call to SignDigitally.) If the SignatureOrigin part is not excluded, any additional signatures invalidate the signature of the first signer.

For more information about digital signatures, see Digital Signing Framework of the Open Packaging Conventions.

For more information on the Core Properties and Signature Origin parts, see Chapter 3 of the Open Packaging Conventions specification available for download at https://www.ecma-international.org/publications-and-standards/standards/ecma-376/.

Applies to

See also