XpsDigSigPartAlteringRestrictions 列舉

定義

指定從數位簽章範圍中排除之 XPS Package 的組件。

此列舉支援其成員值的位元組合。

public enum class XpsDigSigPartAlteringRestrictions
[System.Flags]
public enum XpsDigSigPartAlteringRestrictions
[<System.Flags>]
type XpsDigSigPartAlteringRestrictions = 
Public Enum XpsDigSigPartAlteringRestrictions
繼承
XpsDigSigPartAlteringRestrictions
屬性

欄位

Annotations 2

附註的組件已經排除。

CoreMetadata 1

核心屬性的組件已經排除。

None 0

沒有被排除的組件。

SignatureOrigin 4

簽章原點的組件已經排除。

範例

下列範例示範如何使用這個列舉來數位簽署 XPS 檔。


// ------------------------------ 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,可允許其成員值的位元組合。

指定為已從數位簽章中排除的部分可以修改,而不會使簽章失效。 例如,如果檔是由多個人員簽署,則第一次簽署檔時,SignatureOrigin 元件必須從簽章中排除。 (排除專案是在呼叫 SignDigitally .) 的 參數中 restrictions 指定。如果未排除 SignatureOrigin 元件,則任何其他簽章會使第一個簽署者的簽章失效。

如需數位簽章的詳細資訊,請參閱 開放式封裝慣例的數位簽章架構

如需核心屬性和簽章原始元件的詳細資訊,請參閱 可供 https://www.ecma-international.org/publications-and-standards/standards/ecma-376/ 下載的開放式封裝慣例規格第 3 章。

適用於

另請參閱