Question

Is there a public / private key encryption scheme that will not change a message's length?

I would like to encrypt a message one packet at a time, but if the packet grows, it would no longer just be one packet long.

Was it helpful?

Solution

Here's a simple scheme: Use public / private key encryption to establish a symmetric key. Then do all of your encryption using that symmetric key.

If you also need to ensure message integrity and non-repudiation, then you can run the message through a hash function, which will map it to a fixed length. Then you can sign the hash.

Typically, you wouldn't want to use public keys to encrypt messages anyway. Public / private key pairs are harder to generate and more expensive to use for long encryption, compared to symmetric keys.

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