The maximum message length for a signature scheme is related to the hash function used, not the key size. But hash functions usually have a input length limit >= 2^64 bits, more than enough for any message you might want to sign.

The reason you're seeing "key too short" is that the key is too short to sign any message in that signature scheme, because of the hash output size and padding length.

----- Original Message ----- From: "Sergio Andrés" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, November 29, 2005 2:41 AM
Subject: message length in RSA signature


Hi all,

I have a doubt about the maximum message length allowed to generate a RSA signature. The message length is 36 bytes, and I would like to know which is the minimum size of N for this message.
In general, I would need the relation between message length and N size.
Although I have read that there is no limit on message length, I got an execution error when the key is too short (size(N) = 45 bytes).

I use Crypto++ Version 4.1.
My code is the following:

  // the private key is encoded Hexadecimal
  StringSource sPri(p_priclave, true, new HexDecoder);
  RSASSA_PKCS1v15_SHA_Signer privkey(sPri);
  AutoSeededRandomPool rp;
  std::string sSignature;
StringSource(p_msg, true, new SignerFilter(rp, privkey, new StringSink(sSignature)));

I hope you can help me.
Thanks in advance.

Sergio.



Reply via email to