XpsDigSigPartAlteringRestrictions Enum

Definition

指定從數位簽章範圍中排除之 XPS Package 的組件。Specifies the parts of the XPS Package that are excluded from the range of a digital signature.

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

public enum class XpsDigSigPartAlteringRestrictions
[System.Flags]
public enum XpsDigSigPartAlteringRestrictions
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

下列範例示範如何使用這個列舉,以數位方式簽署 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

Remarks

這個列舉具有允許成員值之位元組合的 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. (在 SignDigitally呼叫的 restrictions 參數中指定排除專案)。 如果未排除 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.

Applies to

See also