XpsDigSigPartAlteringRestrictions 枚举

定义

指定从数字签名的范围内排除的 XPS Package 的各个部件。Specifies the parts of the XPS Package that are excluded from the range of a digital signature.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class XpsDigSigPartAlteringRestrictions
[System.Flags]
public enum XpsDigSigPartAlteringRestrictions
type XpsDigSigPartAlteringRestrictions = 
Public Enum XpsDigSigPartAlteringRestrictions
继承
XpsDigSigPartAlteringRestrictions
属性

字段

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.

示例

下面的示例演示如何使用此枚举对 XPSXPS 文档进行数字签名。The following example shows how to use this enumeration to digitally sign an XPSXPS 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

注解

此枚举有一个 FlagsAttribute,它允许其成员值的按位组合。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. 例如,如果某个文档要由多个用户进行签名,则在首次对该文档进行签名时,需要从签名中排除 SignatureOrigin 部分。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. (排除项在调用 SignDigitallyrestrictions 参数中指定。)如果未排除 SignatureOrigin 部分,则任何其他签名将使第一个签名者的签名无效。(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.

有关数字签名的详细信息,请参阅 MSDN 文章https://go.microsoft.com/fwlink/?LinkId=74494上提供的开放打包约定的数字签名框架For more information about digital signatures, see the MSDN article Digital Signing Framework of the Open Packaging Conventions available at https://go.microsoft.com/fwlink/?LinkId=74494.

有关核心属性和签名源部件的详细信息,请参阅 https://go.microsoft.com/fwlink/?LinkID=71255上可供下载的开放打包约定规范的第3章。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://go.microsoft.com/fwlink/?LinkID=71255.

适用于

另请参阅