0

I'm familiar with RSA for asymmetric encryption. I also understand it's only supposed to encrypt small amounts of data (smaller than the key) so for encrypting arbitrary data I would typically generate a one-time random key, encrypt just that random key with asymmetric encryption, and then encrypt the actual data using AES with the random key (and then throw away the plaintext key)

Can I also use Elliptic Curve Cryptography for this? And if yes, can I use any common type of curves / keys?

For example, can I create a Ed25519 or Secp256k1 or Secp521r1 keypair, and then encrypt something with the public key so it can only be decrypted with the corresponding private key?

I sometimes read things like 'Ed25519 is only for signatures, not encryption' or 'ECC is only for authentication'.

Suppose I have an RSA keypair MyPrivateRsaKey.pem and MyPublicRsaKey.pem and a small data file secret.txt.
I can encrypt secret.txt using MyPublicRsaKey.pem, and then the encrypted data can only be decrypted with MyPrivateRsaKey.pem.

Now if I have a keypair MyPrivateEd25519Key.pem and MyPublicEd25519Key.pem for example, can I do the same? Or am I mistaken and are elliptic curve keys fundamentally unsuitable for this?

P.S. note that for the context of this question, I'm not dealing with key exchange or signatures or certificates or authentication. Just asymmetric encryption+decryption.

RocketNuts
  • 1,387
  • 1
  • 11
  • 23
  • The most standard such scheme is [tag:ECIES], described in SEC1. Another is EC-ElGamal. The two are compared in ECIES (…) EC-ElGamal encryption comparison. This can be a bootstrap for hybrid encryption. How this is done with Ed25519 keys is treated in Difference between X25519 vs. Ed25519. How to do this with practical tools is off-topic. – fgrieu Oct 31 '20 at 14:25