Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

VerifyResult Enumeration

Specifies the result of a certificate or signature verification.

Namespace:  System.IO.Packaging
Assembly:  WindowsBase (in WindowsBase.dll)
public enum VerifyResult
<object property="enumerationMemberName" .../>
Member nameDescription
SuccessThe verification was successful.
InvalidSignatureThe signature is not valid.
CertificateRequiredThe X.509 certificate is not available to verify the signature.
InvalidCertificateThe X.509 certificate is not valid.
ReferenceNotFoundA reference relationship to the signature was not found.
NotSignedThe specified package or part has no signature.

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

For the complete sample, see Creating a Package with a Digital Signature Sample.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.