VerifyResult VerifyResult VerifyResult VerifyResult Enum

정의

인증서 또는 서명 확인의 결과를 지정합니다.Specifies the result of a certificate or signature verification.

public enum class VerifyResult
public enum VerifyResult
type VerifyResult = 
Public Enum VerifyResult
상속

필드

CertificateRequired CertificateRequired CertificateRequired CertificateRequired 2

X.509 인증서를 사용하여 서명을 확인할 수 없습니다.The X.509 certificate is not available to verify the signature.

InvalidCertificate InvalidCertificate InvalidCertificate InvalidCertificate 3

X.509 인증서가 잘못되었습니다.The X.509 certificate is not valid.

InvalidSignature InvalidSignature InvalidSignature InvalidSignature 1

서명이 잘못되었습니다.The signature is not valid.

NotSigned NotSigned NotSigned NotSigned 5

지정된 패키지 또는 파트에 서명이 없습니다.The specified package or part has no signature.

ReferenceNotFound ReferenceNotFound ReferenceNotFound ReferenceNotFound 4

서명에 대한 참조 관계를 찾을 수 없습니다.A reference relationship to the signature was not found.

Success Success Success Success 0

확인이 완료되었습니다.The verification was successful.

예제

다음 예제에서는 사용 하는 방법의 VerifyResult 열거형입니다.The following example shows how to use the VerifyResult enumeration.

// ------------------------ 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()

전체 샘플을 참조 하세요 디지털 서명 샘플을 사용 하 여 패키지를 만드는합니다.For the complete sample, see Creating a Package with a Digital Signature Sample.

적용 대상

추가 정보