Use this verification code.

for (int k = 0; k < names.Count; ++k) {
    String name = names[k];
    Console.Out.WriteLine("Signature name: " + name);
    Console.Out.WriteLine("Signature covers whole document: " +
af.SignatureCoversWholeDocument(name));
    Console.Out.WriteLine("Document revision: " + af.GetRevision(name)
+ " of " + af.TotalRevisions);
    PdfPKCS7 pk = af.VerifySignature(name);
    DateTime cal = pk.SignDate;
    Org.BouncyCastle.X509.X509Certificate[] pkc = pk.SignCertificateChain;
    TimeStampToken ts = pk.TimeStampToken;
    if (ts != null)
        cal = pk.TimeStampDate;
    if (!pk.IsTsp && ts != null) {
        bool impr = pk.VerifyTimestampImprint();
        Console.Out.WriteLine("Timestamp imprint verifies: " + impr);
        Console.Out.WriteLine("Timestamp date: " + cal);
    }
    Console.Out.WriteLine("Subject: " +
PdfPKCS7.GetSubjectFields(pk.SigningCertificate).GetField("CN"));
    Console.Out.WriteLine("Document modified: " + !pk.Verify());
    Object[] fails = PdfPKCS7.VerifyCertificates(pkc, kall, null, cal);
    if (fails == null)
        Console.Out.WriteLine("Certificates verified against the KeyStore");
    else
        Console.Out.WriteLine("Certificate failed: " + fails[1]);
}

Paulo

On Wed, Apr 25, 2012 at 3:02 PM,  <aszo...@szomor.hu> wrote:
>>>> -LTV Timestamp Certificates verifified False
>>>>
>>>> You'll have to feed the correct trusted certificate to verify.
>>>>
>>>> Paulo
>>>
>>>
>>> The "Test Root CA 2008" placed in my "Trusted root certification
>>> authorities" is not enough this?
>>
>>
>> You need the root of the timestamp certificate, not yours.
>
> As you can see in attached
> I01110055203_ORIGINAL_APEH_XML_SIGNED_PADES_LTV_2.png the timestamp issuer
> is "e-Szigno Test TSA2" which is issued by "Microsec e-Szigno Test Root CA
> 2008" thus this Root CA not just the signer's root but the tsa's root too!
>
> Attila.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> 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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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

Reply via email to