I'm having this issue with some digital signed pdfs.
Here is the code that gets the exception:
var signatureFields = document.AcroForm.FormFields.Where(field => field.FieldType == FormFieldType.Signature).ToList();
if (signatureFields.IsNotNullOrEmpty())
{
foreach (var signatureField in signatureFields)
{
var field = (SignatureField)signatureField;
if (field != null && field.Signature != null)
{
var test = field.Signature.Validate(); - this is the line where I get the exceptions!
The method Validate() called without the properties parameter throws exception in 2 cases:
1st - using pdf signed with specialized software
Message: "No signature validation handler was found for the subfilter: ETSI.CAdES.detached
and the StackTrace: at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Signature.Validate(SignatureValidationProperties validationProperties)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Signature.Validate()\r\n at... (there goes the path in my project)
2nd - using pdf signed with the same digital signature by Adobe Acrobat Reader
Message "ASN1 bad tag value met.\r\n"
and the StackTrace: at System.Security.Cryptography.Pkcs.SignedCms.OpenToDecode(Byte[] encodedMessage, ContentInfo contentInfo, Boolean detached)\r\n at System.Security.Cryptography.Pkcs.SignedCms.Decode(Byte[] encodedMessage)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Pkcs7Detached.ValidateOverride(SignatureDataProperties dataProperties, SignatureValidationProperties validationProperties)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.SignatureValidationHandlerBase.Validate(SignatureDataProperties dataProperties, SignatureValidationProperties validationProperties)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Signature.Validate(SignatureValidationProperties validationProperties)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Signature.Validate()\r\n at... (there goes the path in my project)
I'll be glad if you can tell me where the problem is and what can I do to fix it.
I want to be clear, there are just some correctly signed pdfs that cannot pass this validation. Most of them can but I'm afraid that I am missing something, as one of the non-passing digital signatures is new.