Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Problem with calculating hash in IText

Dimiter Nikolov

2006-08-30


I've read the following thread in your mailing list
  archive.
  From: Paulo Soares <psoares@(protected)...>
  RE: strange signature creation in itext
  2005-09-28 01:54  
  There's nothing strange with that. All te pdfs
have
  an internal creation
  date and that alone would be enough to get a
  different hash.
 
  -----Original Message-----
   From: Tamas Nemeth
  [mailto:szederkertiparazna@(protected)...]
   Sent: Tuesday, September 27, 2005 11:16 PM
   To: itext-questions@(protected)
   Subject: strange signature creation in itext
   
   Hi!
   
   I'm trying to create command line pdf signer,
  which creates a signed
   pdf in 2 part. First an external program calls
me
  to get a hash (my

   program creates the hash and gives back to the
  external program), then
   the external program creates a pkcs7 file onto
  that hash and gives
  back to my command line program. After that my
  command line program
   inserts the hash into the pdf file.
   This works good, but sometimes (10:1) I get
  different hash when I
   create hash, and when I try to insert the pkcs7
  file into the pdf.
   As I see iText sometimes creates different pdf
  structure and that is
   why I get different hash values. I can't see the
  logic behind that.
   Can somebody tell meg, why creates iText
different
  structure
   sometimes. Is there any way to always create the
  same structure (hash)
   onto the same pdf?
 
  I have the same problem. So I don't think the
problem
  of calculating different hashes is the internal
  creation date because:
  1. I've tried to put this creation date
  programmatically through the following code:
    Calendar cal = Calendar.getInstance();
    long l = 1156153389444L;
    cal.setTimeInMillis(l);
    sap.setSignDate(cal);
  , so the creation date is the same all the time.
  2. The problem appears only on Linux(Trustix
Secure
  Linux 3.0) OS. In Windows it works just fine - the
  hash of given document is equal all times. On
Linux
  the hash is same all the times only if the java
  interpreter mode is chosen(java -Xint). But then
it
  works 10 times slower. Java version on both OS :
jdk 1.5.0_02. IText version: itext-paulo-155.jar.
 
  I hope you can help me fix this problem. Thanks in
  advance!
  Best regards,
  Dimitar


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.