What should iText put in the missing bytes to fill the 16 positions: all zeros or something else?
Paulo -----Original Message----- From: mkl [mailto:m...@wir-sind-cool.org] Sent: Thursday, May 06, 2010 2:01 PM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] ArrayIndexOutOfBoundsException when signing Documaker PDF msinatl, msinatl wrote: > Thanks for your response. Please pardon my ignorance, but what is the > document ID and how can I retrieve it? If you look at the PDF document using a text or hex viewer or a dedicated PDF analysis tool, you'll find the trailer dictionary nearly at the end of it. In the case of your example document http://old.nabble.com/file/p28472754/74AA0C69-01F4-4114-6A2D-81D7E7101480-0-IDS-1-BLP.PDF 74AA0C69-01F4-4114-6A2D-81D7E7101480-0-IDS-1-BLP.PDF : trailer <</ID [ (22) (22)]/Size 4>> The document ID is the entryin square brackets after the /ID name, i.e. (22) (22). This is wrong. The PDF spec ISO 32000-1:2008 states in 14.4: File identifiers shall be defined by the optional ID entry in a PDF file's trailer dictionary (see 7.5.5, "File Trailer"). The ID entry is optional but should be used. The value of this entry shall be an array of two byte strings. The first byte string shall be a permanent identifier based on the contents of the file at the time it was originally created and shall not change when the file is incrementally updated. The second byte string shall be a changing identifier based on the file's contents at the time it was last updated. When a file is first written, both identifiers shall be set to the same value. If both identifiers match when a file reference is resolved, it is very likely that the correct and unchanged file has been found. If only the first identifier matches, a different version of the correct file has been found. To help ensure the uniqueness of file identifiers, they should be computed by means of a message digest algorithm such as MD5 (described in Internet RFC 1321, The MD5 Message-Digest Algorithm. At first glance, that ID of yours is wrong as it uses literal strings and not byte strings. It additionally is likely wrong as a two-character ID generally does not ensure uniqueness. On the other hand iText is wrong in assuming a length of exactly 16 bytes in PdfEncryption.createInfoId() because the MD5 digest is merely an example for a way to generate something unique enough. Regards, Michael. -- View this message in context: http://old.nabble.com/ArrayIndexOutOfBoundsException-when-signing-Documaker-PDF-tp28466347p28473274.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
------------------------------------------------------------------------------
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/