Hello Andrea
I have a signed PDF and I want to change its signature.
You said it's quite easy, so I will ask you to give me an example.
I've tried to put the new signature bytes and I failed.
I've retrieved the PKCS7 from the PDF, changed the signature and then tried
to insert it in the same place the previous PKCS7 was. I failed.
Could you please show me some code?
Gonçalo
2009/2/10 Andreas Kuehne <[email protected]>
> Hi,
>
> here's code for extracting hash from signature :
>
> // core aspect of PDF signatures :
> // signatures are made by a special / partial hash
> MessageDigest messageDigest = MessageDigest.getInstance(
> getDocumentHashAlgorithm() );
> byte read_buf[] = new byte[ hashBufferSize ];
> int n;
> InputStream inp = sap.getRangeStream();
> while ( ( n = inp.read( read_buf ) ) > 0) {
> messageDigest.update( read_buf, 0, n );
> }
> byte pdf_hash[] = messageDigest.digest();
>
> Replacing the existing signature content is easy as I created it upfront
> with well known content, big enough to hold the hex-coded signature. Once
> the signature is ready, it's a simple find'n'replace method on the PDF file.
>
> Greetings
>
> Andreas
>
> --
> Andreas Kühne phone: +49 177 293 24 97 mailto: [email protected]
>
> Trustable Ltd. Niederlassung Deutschland Ströverstr. 18 - 59427 Unna
> Amtsgericht Hamm HRB 5868
>
> Directors Andreas Kühne Heiko Veit
>
> Company UK Company No: 5218868 Registered in England and Wales
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>
--
Cumprimentos,
Gonçalo Almeida
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php