Hi
No problem.
This is the code I'm running:
- Code: Select all
static void GetDoubleSignature(PdfDocument doc, X509Certificate2 cert)
{
var chain = new X509Chain();
chain.Build(cert);
var extraCerts = new X509Certificate2Collection();
foreach (var element in chain.ChainElements)
{
extraCerts.Insert(0, element.Certificate);
}
PdfPKCS7Formatter formatter = new PdfPKCS7Formatter(extraCerts[extraCerts.Count - 1], false);
formatter.ExtraCertificateStore = extraCerts; //full certificate chain support.
//formatter.OCSPService = new OCSPHttpService("http://ocsp.eid.belgium.be/");
PdfOrdinarySignatureMaker maker = new PdfOrdinarySignatureMaker(doc, formatter);
//The location of the signature in the pdf
maker.MakeSignature("signature");
}
And as you can see, the extraCerts collection contains 3 members:
Screenshot 2023-06-14 100242.png
When I view the resulting pdf on my own PC, where I did the signing, I can see the full chain:
Screenshot 2023-06-14 100631.png
When I view it on a different PC, I only see the "bottom" certificate:
Screenshot 2023-06-14 100748.png
If there's anything else you want, please let me know.
Login to view the files attached to this post.