Dear Team, I signed my pdf by the examples: 1, How to sign with a timestamp and OCSP in C# http://itextpdf.sourceforge.net/howtosign.html#signtsocspcs 2, How to apply verification according to PAdES-LTV http://itextpdf.sourceforge.net/howtosign.html#ltvitext and try to verify it by the exammple: 3, How to verify with iTextSharp http://itextpdf.sourceforge.net/howtosign.html#howtoverifycs the PAdES-LTV was not valid by the example.
If I open the signed pdf wit Acrobat Reader it says all signature is valid. How can I verify the PAdES-LTV from code ? Thanks, Attila. RESULT: ------- Signature name: Signature1 Signature covers whole document: False Document revision: 1 of 2 Subject: NetLock Teszt Aláíró tanúsítvány Document modified: False Certificates verified against the KeyStore Signature name: Signature2 Signature covers whole document: True Document revision: 2 of 2 Subject: e-Szigno Test TSA2 Document modified: True Certificate failed: The certificate has expired or is not yet valid CODE: ----- public virtual void Verify(Stream inStream) { List<X509Certificate> kall = new List<X509Certificate>(); System.Security.Cryptography.X509Certificates.X509Store store = new System.Security.Cryptography.X509Certificates.X509Store( System.Security.Cryptography.X509Certificates.StoreName.CertificateAuthority, System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser); store.Open(System.Security.Cryptography.X509Certificates.OpenFlags.ReadOnly); try { X509CertificateParser certParser = new X509CertificateParser(); System.Security.Cryptography.X509Certificates.X509Certificate2Collection col = store.Certificates; foreach (System.Security.Cryptography.X509Certificates.X509Certificate2 cer in col) { kall.Add(certParser.ReadCertificate(cer.RawData)); } } finally { store.Close(); } PdfReader reader = new PdfReader(inStream); AcroFields af = reader.AcroFields; List<String> names = af.GetSignatureNames(); for (int k = 0; k < names.Count; ++k) { String name = names[k]; System.Console.Out.WriteLine("Signature name: " + name); System.Console.Out.WriteLine("Signature covers whole document: " + af.SignatureCoversWholeDocument(name)); System.Console.Out.WriteLine("Document revision: " + af.GetRevision(name) + " of " + af.TotalRevisions); PdfPKCS7 pk = af.VerifySignature(name); DateTime cal = pk.SignDate; X509Certificate[] pkc = pk.Certificates; System.Console.Out.WriteLine("Subject: " + PdfPKCS7.GetSubjectFields(pk.SigningCertificate).GetField("CN")); System.Console.Out.WriteLine("Document modified: " + !pk.Verify()); Object[] fails = PdfPKCS7.VerifyCertificates(pkc, kall, null, cal); if (fails == null) System.Console.Out.WriteLine("Certificates verified against the KeyStore"); else System.Console.Out.WriteLine("Certificate failed: " + fails[1]); } } ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php