Hi,
I have a timestamp that was built with an algorithm SHA-256. When I use the 
verifyTimestampImprint() function to verify the timestamp, it fails.
Thus, I had to change the function as follows:

    public boolean verifyTimestampImprint() throws NoSuchAlgorithmException {
        if (timeStampToken == null)
            return false;
        TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
        MessageImprint imprint = info.toTSTInfo().getMessageImprint();
        String algOID = info.getMessageImprintAlgOID();
        byte[] md = MessageDigest.getInstance(algOID).digest(digest);
        byte[] imphashed = imprint.getHashedMessage();
        boolean res = Arrays.equals(md, imphashed);
        return res;
    }


and it works.

If you found other ways to verify timestamp built with an algorithm SHA-256 
please let me know.

Regards,


Alfonso Massa


________________________________
AVVISO DI RISERVATEZZA
Informazioni riservate possono essere contenute nel messaggio o nei suoi 
allegati. Se non siete i destinatari indicati nel messaggio, o responsabili per 
la sua consegna alla persona, o se avete ricevuto il messaggio per errore, 
siete pregati di non trascriverlo, copiarlo o inviarlo a nessuno. In tal caso 
vi invitiamo a cancellare il messaggio ed i suoi allegati. Grazie.

CONFIDENTIALITY NOTICE
Confidential information may be contained in this message or in its 
attachments. If you are not the addressee indicated in this message, or 
responsible for message delivering to that person, or if you have received this 
message in error, you may not transcribe, copy or deliver this message to 
anyone. In that case, you should delete this message and its attachments. Thank 
you.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
iText-questions mailing list
[email protected]
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