XpsDigSigPartAlteringRestrictions 列舉
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定從數位簽章範圍中排除之 XPS Package 的組件。
此列舉支援其成員值的位元組合。
public enum class XpsDigSigPartAlteringRestrictions
C#
[System.Flags]
public enum XpsDigSigPartAlteringRestrictions
[<System.Flags>]
type XpsDigSigPartAlteringRestrictions =
Public Enum XpsDigSigPartAlteringRestrictions
- 繼承
- 屬性
名稱 | 值 | Description |
---|---|---|
Annotations | 2 | 附註的組件已經排除。 |
CoreMetadata | 1 | 核心屬性的組件已經排除。 |
None | 0 | 沒有被排除的組件。 |
SignatureOrigin | 4 | 簽章原點的組件已經排除。 |
下列範例示範如何使用這個列舉來數位簽署 XPS 檔。
C#
// ------------------------------ 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 章。
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |