The first image is from a pdf signature which is LTV enabled. This document is not created by me.
In the revocation information, it shows the following text:
The selected certificate is considered valid because it has not been revoked as verified using the Online Certificate Status Protocol (OCSP) response that was embedded in the signature.
I do sign a pdf document using iText and I also apply an OCSP.
OCSPVerifier ocspVerifier = new OCSPVerifier(null, null); // null,null >https://stackguides.com/questions/40765907/itextsharp-ocspclientbouncycastle-constructor-is-deprecated-whats-the-replacem
IOcspClient ocspClient = new OcspClientBouncyCastle(ocspVerifier);
var ocsp = ocspClient.GetEncoded(ocspCert,ocspRootCert, "http://www.myurl.com/aia/ocsp");
if (ocsp == null)
Console.WriteLine("oscp is null");
else
Console.WriteLine("ocsp is not null");
//Create the pkcs7 container
PdfPKCS7 sgn = new PdfPKCS7(null, c.ToArray(), HashAlgorithm, false);
Console.WriteLine("PdfPKCS7");
byte[] sh = sgn.GetAuthenticatedAttributeBytes(hash, ocsp, null, PdfSigner.CryptoStandard.CMS);
Console.WriteLine("GetAuthenticatedAttributeBytes");
//Load the signature via pkcs11 hardware
byte[] extSignature = GetSignatureFromHashViaPkcs11(sh, pin);
Console.WriteLine("GetSignatureFromHashViaPkcs11");
sgn.SetExternalDigest(extSignature, null, DigestEncryptionAlgorithm);
Console.WriteLine("SetExternalDigest");
var ret = sgn.GetEncodedPKCS7(hash, tsaClient, ocsp, null, PdfSigner.CryptoStandard.CMS);
Console.WriteLine("GetEncodedPKCS7");
Console.WriteLine($"IsTsp : {sgn.IsTsp()}");
In this case, the produced signature is shown as valid but LTV is not enabled:
In the revocation information, it shows the following text:
The selected certificate is considered valid because it has not been revoked as verified in real-time using the Online Certificate Status Protocol (OCSP) obtained on-line.
My guess is that this difference is responsible for the LTV issue. How can i set the OCSP using iText so that it is embedded instead of obtained on-line?