I'm using itextSharp in C# to sign a pdf. I have created a method but after the pdf is signed, it isn't ltv enabled. I searched and found the code snippet below which adds ltv enable to pdf but I don't know how I'm supposed to create the variables ocsp, and crl. What I'm really confused about is the type of information this variables should contain for example should ocsp be a string url or signature name etc? The documentation for these variable on the itextsupport site is very poor and I can't understand what I'm required to provide. Please any help on how to create these two variables ocsp and crl (with an example and a brief explanation), will be greatly appreciated.
using (FileStream fos = new FileStream(@"d:\test.pdf", FileMode.Create))
{
PdfReader r = new PdfReader(signedDocument);
PdfStamper stp = new PdfStamper(r, fos, '\0', true);
LtvVerification v = stp.LtvVerification;
AcroFields fields = stp.AcroFields;
List<String> names = fields.GetSignatureNames();
String sigName = names[names.Count - 1];
PdfPKCS7 pkcs7 = fields.VerifySignature(sigName);
if (pkcs7.IsTsp)
{
v.AddVerification(sigName, ocsp, crl,
LtvVerification.CertificateOption.SIGNING_CERTIFICATE,
LtvVerification.Level.OCSP_CRL,
LtvVerification.CertificateInclusion.YES);
}
else
{
foreach (string name in names)
{
v.AddVerification(name, ocsp, crl,
LtvVerification.CertificateOption.WHOLE_CHAIN,
LtvVerification.Level.OCSP_CRL,
LtvVerification.CertificateInclusion.NO);
}
}
stp.Close();
r.Close();
}