Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a size restriction on signatures in Java (java.security)?

I am trying to sign a token object using SHA1. I am using bouncycastle as the security provider. Whenever the program tries to sign something it gives me this error.

java.security.SignatureException: java.lang.IllegalArgumentException: input data too large.

What is the maximum size for signing something? Do you have any suggestions about how I can sign this object?

like image 297
Gregory Porter Avatar asked Apr 20 '10 19:04

Gregory Porter


1 Answers

The input size is limited to the size of the key. If you use a 1024 bit key, you are limited to 128 bytes.

Typically, you are signing the digest (hash value), not the actual data.

like image 112
Marcus Adams Avatar answered Oct 06 '22 00:10

Marcus Adams