Question

If i'm using UTF-8 encoding, how many characters can i safely encrypt with different size RSA keys using PKCS1 padding?

EDIT: I understand that the answer would depend on which characters i'm encrypting, but as this is variable, i'm after a "worst case" safe limit for different key sizes (1024 2048 4096). Just something to go on.

Was it helpful?

Solution

To quote from RFC 3447, §7.1:

RSAES-OAEP can operate on messages of length up to k - 2hLen - 2 octets, where hLen is the length of the output from the underlying hash function and k is the length in octets of the recipient's RSA modulus.

This is defined in terms of octets; exactly how many characters that'll equate to will depend on the characters you encode. One code point can occupy more than one octet, and one character (as most people think of it, anyway) can require more than one code point.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top