Take the 2-minute tour ×

What are the best asymmetric encryption algorithms out there? I am trying to use RSA in my project howoever I have read that it is not quite secure as other asymmetric encryption algorithms.

share|improve this question

closed as not a real question by Adi, Gilles, AJ Henderson, Iszi, lynks Apr 30 '13 at 16:57


Where exactly did you read that? –  Terry Chia Apr 28 '13 at 12:25
RSA is secure, it is by far the most widely used asymmetric algorithm out there. –  lynks Apr 28 '13 at 12:27
Oops! I misread some information. However, I read that RSA cannot be used to encrypt very long messages. The encrypted message should not exceed 128 bytes. Is that correct? –  Matthew Apr 28 '13 at 12:30
@Matthew That's why you should use hybrid encryption. Choose a random key, encrypt the actual message with symmetric crypto (for example AES-GCM) and then encrypt that key with RSA (don't forget proper padding i.e. OAEP). –  CodesInChaos Apr 28 '13 at 12:42

1 Answer 1

up vote 7 down vote accepted

"Best" implies some gradation on a scale, which should be defined...

The most commonly used asymmetric encryption algorithm is RSA. It is good enough for most purposes. RSA has some limitations, which are rather generic (i.e. which apply to most other asymmetric encryption algorithms as well):

  • It can process only limited-size messages (with a 1024-bit RSA key, you can encrypt at most 117 bytes).
  • It implies some size overhead (with a 1024-bit RSA key, you get a 128-byte encrypted message, even though the source message has size no more than 117 bytes).
  • It must use some randomness (deterministic asymmetric encryption is intrinsically weak because it allows for exhaustive search on the message itself).
  • It can be relatively expensive on very small architectures.

To work around most of these issues, hybrid encryption is used: with RSA, you encrypt a random symmetric key (i.e. 128 random bits) and you use that key to encrypt the bulk of the data with a faster, less constrained symmetric encryption algorithm like AES.

Another relatively common asymmetric encryption algorithm is ElGamal. Its elliptic curve variants can offer better performance than RSA (faster, less size overhead), but hybrid encryption is still needed.

Assembling asymmetric and symmetric encryption correctly is not an easy task, so don't go creative and invent your own (it is easy to have something which works, but very hard to obtain something which works securely). Instead, use an existing protocol where all the tricky details have been worked out; e.g. OpenPGP.

share|improve this answer
