Question

In my scenario, I would like to encrypt a very big number (10^27) using a private key and later be able to decrypt it using a public key. The problem I have is that I want to keep the size of the encrypted text as small as possible.

I know that .NET has support for public key encryption (RSACryptoServiceProvider), but the encrypted text gets so huge.

Would it work to instead treat the private key as a public key?

Would Elliptic curve cryptography produce a smaller output?

Was it helpful?

Solution

First of all, if you want to achieve confidentiality you should always encrypt with the public key, not the private key. RSA encryption is not defined for encryption with the private key, and the results may vary (especially the kind of padding that is applied).

For direct RSA encryption, the size of the encrypted message is identical to the modulus. Now the modulus should be at least 2048 bits by now, and your message is only about (27/3)*10=90 bits. So RSA would have a large overhead, independent on the key used. Using ECIES is therefore likely to give significant benefits.

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