We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problems with validating a digital signature

Hello.


I have problems with digital signature validation.

My code for .NET in C#:

if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(openFileDialog1.FileName);
if (pdfSign.ContainsSignature())
{
MessageBox.Show(“PDF Firmado”);

//Obtenermos las distintas firmas
using (pdfSign)
{
System.Collections.IList sigNames = pdfSign.GetSignNames();
if (sigNames.Count > 0)
{
// Validamos las distintas firmas
int contador = 0;
string sigName = “”;
while (contador < sigNames.Count)
{
sigName = sigNames[contador] as string;
string auxi = pdfSign.GetSignerName(sigName);

if (pdfSign.VerifySigned(sigName)) { MessageBox.Show("PDF firmado por " + sigName); }
else { MessageBox.Show(“PDF NO firmado por " + sigName); }

//Comprueba la firma extraida…
if (pdfSign.VerifySignature(sigName)) { MessageBox.Show(“Firma de F” + sigName + " verificada.”); }
else { MessageBox.Show(“Firma de " + sigName + " NO verificada”); }

contador++;
}
}
}
}
else { MessageBox.Show(“Va ser que no se ha firmado el PDF”); }
pdfSign.Close();
}

The problem is that pdfSign.GetSignNames() does not return the name of the signer, it only returns the string Signature1. –> sigNames[contador] = “Signature1” and pdfSign.GetSignerName(sigName) return Signature1 too.

I can not find a way to get the name of the signer.

Thanks for your time.

Hi Miguel,


Thanks for contacting support.

We will really appreciate if you please share a sample input document so that we can test the scenario in our environment and get back to you with some useful information accordingly. We are sorry for the inconvenience.


Best Regards,

Thanks for your quick answer.


In the attached test document the signer is JUAN GARCÍA LÓPEZ, but GetSignNames() does not return that name.

Signature on the last sheet.

I use Acrobat Reader to open and view the document.

Thank you very much.

Hi Miguel,


Thanks for sharing your document. I have tried to get the Signer Name form the document which you have shared and was unable to get the correct name. It only returns “Signature1”. Therefore for the sake of detailed investigation of the issue I have logged it as PDFNET-42394 in our issue tracking system. We will further look into the details causing the issue and keep you informed on the status of its resolution within this thread. Please be patient and spare us a little time.

We are sorry for the inconvenience.


Best Regards,