Hello
SigningHub Two Signer Seal.pdf (413.7 KB)
I want to understand whether the certificate in the pdf is a signing certificate or a timestamp certificate with a code like the one below, but I can’t find a correct way. The ServiceProviderName in the certificate can be variable.
using (MemoryStream mstrm = new MemoryStream(pPDFBytes))
using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(mstrm))
foreach (Aspose.Pdf.Forms.Field field in pdfDocument.Form)
{
Aspose.Pdf.Forms.SignatureField sf = field as Aspose.Pdf.Forms.SignatureField;
if (sf != null && sf.Signature != null)
{
try
{
var a = sf.FullName;
var b = sf.PartialName;
var c = sf.Signature.TimestampSettings; // null for UAE
var d = sf.Value;
var e = sf.GetType();
var f = sf.Signature.GetType().Name;
var g = sf.Signature.ContactInfo;
var i = sf.Signature.ServiceProviderName;
var j = sf.Signature.Date;
var k = sf.Signature.Location;
var m = sf.Signature.Reason;
}
catch (Exception ex)
{
ex.HelpLink = ex.Message;
}
byte[] cert_arr = null;
System.Security.Cryptography.X509Certificates.X509Certificate2 cert = null;
using (MemoryStream ms = new MemoryStream())
{
sf.ExtractCertificate().CopyTo(ms);
cert_arr = ms.ToArray();
cert = new X509Certificate2(new X509Certificate(cert_arr));
var SignerName = cert.GetNameInfo(X509NameType.SimpleName, false);
var SignerEmail = cert.GetNameInfo(X509NameType.EmailName, false);
var Provider = cert.GetNameInfo(X509NameType.SimpleName, true);
}
}
}