New to Telerik Document Processing? Start a free 30-day trial
Validating a Signature
Updated on May 13, 2026
The validation is performed for the current field and, since it strongly depends on the file bytes of the document, against the state of the document at the moment of importing.
The Signature class exposes two methods that allow you to validate a signature:
| Method | Description |
|---|---|
Validate() | Accepts a SignatureValidationProperties parameter and validates the signature using those properties. Returns a SignatureValidationResult. |
TryValidate() | Returns a bool indicating whether validation succeeded. The first overload accepts an out parameter containing a SignatureValidationResult; the second overload also accepts SignatureValidationProperties. |
The SignatureValidationProperties class exposes the following properties:
| Property | Description |
|---|---|
Chain | Gets or sets the chain used to validate the certificate that signed the digital signature. Of type X509Chain. |
ChainStatusFlags | Gets or sets the chain status flags that describe the used signature certificate as invalid. Of type X509ChainStatusFlags. |
The validation requires that the stream, from which the document is imported, to be opened. The validation is performed for the current field and against the state of the document at the moment of importing.
The following example shows how the validation can be used:
Example: Validate a field
C#
RadFixedDocument document = new PdfFormatProvider().Import(File.OpenRead("file-to-import.pdf"), TimeSpan.FromSeconds(10)); // The stream containing the document
string validationStatus;
//For simplicity, the example handles only the first signature.
SignatureField firstSignatureField = document.AcroForm.FormFields.FirstOrDefault(field => field.FieldType == FormFieldType.Signature) as SignatureField;
if (firstSignatureField != null && firstSignatureField.Signature != null)
{
SignatureValidationProperties properties = new SignatureValidationProperties();
System.Security.Cryptography.X509Certificates.X509VerificationFlags verificationFlags = System.Security.Cryptography.X509Certificates.X509VerificationFlags.IgnoreInvalidName;
properties.Chain.ChainPolicy.VerificationFlags = verificationFlags;
SignatureValidationResult validationResult;
if (firstSignatureField.Signature.TryValidate(properties, out validationResult))
{
if (!validationResult.IsDocumentModified)
{
if (validationResult.IsCertificateValid)
{
validationStatus = "Valid";
}
else
{
validationStatus = "Unknown";
}
}
else
{
validationStatus = "Invalid";
}
}
else
{
validationStatus = "Invalid";
}
}
else
{
validationStatus = "None";
}
To evaluate a certificate as trusted, it must be added to the trusted certificates on your machine.