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.

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

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Where exactly did you read that? – user10211 Apr 28 '13 at 12:25
  • 1
    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

"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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.