Skip to content
Guides

Verify Digital Signatures

Verifying a digital signature consists of signature validity and certificate trustworthiness.

  • Signature validity indicates that the document has not been tampered with.
  • Certificate trustworthiness confirms that the signer is trustworthy.

Generally, a signature is verified only when both the signature is valid and the certificate is trustworthy.

This example shows how to verify digital signatures:

C#
foreach (var signature in document.GetSignatureList())
{
    signature.VerifySignatureWithDocument(document);
    foreach (var signer in signature.SignerList)
    {
        Console.WriteLine("Is the certificate trusted: " + signer.IsCertTrusted.ToString());
        Console.WriteLine("Is the signature verified: " + signer.IsSignVerified.ToString());
        // Take appropriate actions based on the verification results.
        if (signer.IsCertTrusted && signer.IsSignVerified)
        {
            // Signature is valid and the certificate is trusted.
            // Perform the corresponding actions.
         }
         else if (!signer.IsCertTrusted && signer.IsSignVerified)
         {
              // Signature is valid but the certificate is not trusted.
              // Perform the corresponding actions.
         }
         else
         {
               // Signature is invalid.
               // Perform the corresponding action.
          }
      }
}