PackageDigitalSignatureManager.IsSigned 속성

정의

패키지에 서명이 포함되어 있는지 여부를 나타내는 값을 가져옵니다.

public:
 property bool IsSigned { bool get(); };
public bool IsSigned { get; }
member this.IsSigned : bool
Public ReadOnly Property IsSigned As Boolean

속성 값

Boolean

패키지에 서명이 포함되어 있으면 true, 그렇지 않으면 false입니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다는 IsSigned 속성을 패키지를 디지털 서명이 있는지 확인 합니다. 전체 샘플을 참조 하세요 디지털 서명 샘플을 사용 하 여 패키지를 만드는합니다.

// ------------------------ ValidateSignatures ------------------------
/// <summary>
///   Validates all the digital signatures of a given package.</summary>
/// <param name="package">
///   The package for validating digital signatures.</param>
/// <returns>
///   true if all digital signatures are valid; otherwise false if the
///   package is unsigned or any of the signatures are invalid.</returns>
private static bool ValidateSignatures(Package package)
{
    if (package == null)
        throw new ArgumentNullException("ValidateSignatures(package)");

    // Create a PackageDigitalSignatureManager for the given Package.
    PackageDigitalSignatureManager dsm =
        new PackageDigitalSignatureManager(package);

    // Check to see if the package contains any signatures.
    if (!dsm.IsSigned)
        return false;   // The package is not signed.

    // Verify that all signatures are valid.
    VerifyResult result = dsm.VerifySignatures(false);
    if (result != VerifyResult.Success)
        return false;   // One or more digital signatures are invalid.

    // else if (result == VerifyResult.Success)
    return true;        // All signatures are valid.
}// end:ValidateSignatures()
' ------------------------ ValidateSignatures ------------------------
''' <summary>
''' Validates all the digital signatures of a given package.</summary>
''' <param name="package">
''' The package for validating digital signatures.</param>
''' <returns>
''' true if all digital signatures are valid; otherwise false if the
''' package is unsigned or any of the signatures are invalid.</returns>
Private Shared Function ValidateSignatures(ByVal package As Package) As Boolean
    If package Is Nothing Then
        Throw New ArgumentNullException("ValidateSignatures(package)")
    End If

    ' Create a PackageDigitalSignatureManager for the given Package.
    Dim dsm As New PackageDigitalSignatureManager(package)

    ' Check to see if the package contains any signatures.
    If Not dsm.IsSigned Then
        Return False
    End If
    ' The package is not signed.
    ' Verify that all signatures are valid.
    Dim result As VerifyResult = dsm.VerifySignatures(False)
    If result <> VerifyResult.Success Then
        Return False
    End If
    ' One or more digital signatures are invalid.
    ' else if (result == VerifyResult.Success)
    ' All signatures are valid.
    Return True
End Function
' end:ValidateSignatures()

설명

IsSigned 속성 서명 유효성 검사를 수행 하지 않습니다. 서명이 있는 경우 및 IsSignedtrue, 하나 이상의 서명에 유효 하지 않을 합니다. 호출 VerifySignatures 서명이 유효 하 고 변경 되지 않은 확인 합니다.

적용 대상

추가 정보