# How is message length involved in public/private-key encryption?

I've just read this question regarding why to sign only the hash of a message. I kind of understood the answer, but the question arisen is now:

Why can I encrypt any text messages with the same method while it is needed to split up the message in order to sign it?

I mean, signing is taking the private key and encrypting e.g. message A and on the other side taking the encrypted message and using the public key to decrypt it. What is the difference that makes the other way around (public key for encryption, private key for decryption) (more) secure?

• Signing is not "taking the private key and encrypting". $\:$ See this answer. $\;\;\;\;$
– user991
Aug 8 '15 at 6:27
• The first one is a great answer and explanation. Anyways, it still does not answer my question entirely. What about the message sizes? The answer states that the message length is limited to keysize - 11bytes. I tested one implementation which threw me an error (message too long), but how is that handled in e.g. PGP for mail encryption? Aug 8 '15 at 6:41
• – user991
Aug 8 '15 at 6:44
• @RickyDemer, bing.com/search?q=hybrid+cryptosystem
– SEJPM
Aug 8 '15 at 18:15
• What do you mean with "with the same method?" What do you mean with "split up the message"? Aug 9 '15 at 9:05

## 2 Answers

First let me emphasis again that signatures are something entirely different than public key encryption. Please read the comments to your question and keep those in mind.

That said, in both cases (signature & public key encryption) schemes are designed for fixed message sizes. For RSA signatures and encryption the maximum message length is determined by the size of $N = pq$ (assuming the school book notation for RSA). You can neither sign longer messages nor encrypt them.

What applications will do is using a cryptographic hash function in case of signatures to reduce the message length to a fixed small value. In case of encryption they will use hybrid encryption, i.e. the application will generate a random secret key for symmetric encryption, encrypt it using the public key scheme and encrypt the message using symmetric encryption with the generated secret key.

The premise that you don't need to split the messages before encryption is incorrect. Given that there are schemes giving (partial) message recovery for signing also means that that premise is incorrect as well. The message doesn't need to be split up before signing (which includes hashing), so that premise, finally, is also incorrect.

Encryption operation, as specified for PKCS#1 encryption, consists of both padding and modular exponentiation. The same goes for signature, which consists of hashing scheme, padding (other than the one used for encryption) and modular exponentiation. The padding may not result in a ciphertext larger than the modulus. Any higher and the encryption will fail. This problem is solved using hybrid encryption where the message for the RSA consists of a message specific symmetric key.

I've explained this for the RSA cryptosystem. You need to perform the same reasoning for other cryptosystems. Given however that all your premises are incorrect, your question cannot be answered.