VerifyResult Enumeration


Specifies the result of a certificate or signature verification.

Namespace:   System.IO.Packaging
Assembly:  WindowsBase (in WindowsBase.dll)

Public Enumeration VerifyResult

Member nameDescription

The X.509 certificate is not available to verify the signature.


The X.509 certificate is not valid.


The signature is not valid.


The specified package or part has no signature.


A reference relationship to the signature was not found.


The verification was successful.

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 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.

.NET Framework
Available since 3.0
Return to top