I have been working with iText and GlobalSign to do digital signatures and Certification on PDF files for the past few months and stuck with one problem.
When I just do signing on pdf and then try to enabled LTV it works perfect without any problem but when I do Certification Signing and then try to enable LTV it enables LTV and shows "Changes have been made to this document that are permitted by the certifying party".
Final Output after sign and LTV enabling:
What i want is after enabling LTV with certification the pdf should display "Document has not been modified since this signature was applied".
I have tried to add crlbytes to Signature but it doesn't work
The code used to add the signature to document :
using (FileStream os = new FileStream(dest, FileMode.CreateNew))
{
PdfReader reader = new PdfReader(src);
IExternalSignatureContainer external = new MyExternalSignatureContainer(sig);
MakeSignature.SignDeferred(reader, fieldname, os, external);
}
The code used to add the LTV to document:
using (FileStream fos = new FileStream(dest, FileMode.CreateNew))
{
PdfReader r = new PdfReader(src);
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();
}
Is there any way to make the certifying signature LTV enabled and have message displayed on pdf as "Document has not been modified since this signature was applied"
Edited :
I have tried bellow code as well but it doesn't work
X509Certificate[] mObjX509CertChain = GlobalSignAPI.CreateChain(mStrSigningCertificate, mStrCACertificate);
ICollection<byte[]> crlBytes = new List<byte[]>
{
mObjX509CertChain[0].GetEncoded(),
mObjX509CertChain[1].GetEncoded()
};
byte[] mObjBEncodedPKCS7 = mObjPKCS7.GetEncodedPKCS7(mObjByteHash, mObjTSAClient, mObjByteOC, crlBytes, CryptoStandard.CADES);
