VerifyResult Enumeration
.NET Framework 3.0
Specifies the result of a certificate or signature verification.
Namespace: System.IO.Packaging
Assembly: WindowsBase (in windowsbase.dll)
Verify
VerifyCertificate
VerifySignatures
InvalidSignatureEvent
PackageDigitalSignature
PackageDigitalSignatureManager
InvalidSignatureEventHandler
Digital Signing Framework of the Open Packaging Conventions
Assembly: WindowsBase (in windowsbase.dll)
| Member name | Description | |
|---|---|---|
| CertificateRequired | The X.509 certificate is not available to verify the signature. | |
| InvalidCertificate | The X.509 certificate is not valid. | |
| InvalidSignature | The signature is not valid. | |
| NotSigned | The specified package or part has no signature. | |
| ReferenceNotFound | A reference relationship to the signature was not found. | |
| Success | 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 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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Reference
System.IO.Packaging NamespaceVerify
VerifyCertificate
VerifySignatures
InvalidSignatureEvent
PackageDigitalSignature
PackageDigitalSignatureManager
InvalidSignatureEventHandler
Other Resources
Creating a Package with a Digital Signature SampleDigital Signing Framework of the Open Packaging Conventions
Community Additions
ADD
Show: