Hi,

Thanks for your explanation.


mkl wrote:
> 
> The example in appendix D or more to the point, the method
> generateNonRepudiationSignature of that BelpicCard class used there,
> therefore, merely puts the hash presented to it into such a sequence
> structure (seemingly using a hard-coded SHA1 algorithm identifier) and
> encodes it.
> 

I presumably got confused as in the book's example the hashed content is
presented to the generateNonRepudiationSignature method and not the document
content directly:

byte[] content = streamToByteArray(sap.getRangeStream());
byte[] hash = MessageDigest.getInstance("SHA-1").digest(content);
byte[] signatureBytes = scd.generateNonRepudiationSignature(hash);


That is the generateNonRepudiationSignature method computes a valid
PKCS#1-signature without getting the actual content but only it's
SHA1-digest.


mkl wrote:
> 
> Your SignHashedContent example, on the other hand, applies SHA1withRSA to
> the calculated hash. This means that it first calculates a SHA1 hash for
> your hash, then puts that new generated hash into a sequence with a SHA1
> identifier, and finally encrypts that sequence using RSA.
> 

Of course I understand that I encrypt the SHA1-hashed contents of the
document and not the content in my SignHashedContent example...

Best regards,

Daniel.
-- 
View this message in context: 
http://old.nabble.com/How-to-sign-examples-tp26886381p27010254.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
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
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/

Reply via email to