0

Let's say I have aggregated ~1GB of data in memory into a string or corresponding data structure. My goal is to encrypt this data before sending it over the wire. With my limited understanding of encryption, I was looking into asymmetric key encryption and using a public key to do this task. Upon a couple Google searches, it sounds like this will not be possible due to the byte limitation of encryption with a public key. (Is this correct?).

Alternatively, what are my options for achieving something like this? My goal is to essentially perform encryption in memory of large amounts of information without writing to disk.

  • 1
    Symmetric for the file. Asymmetric for the symmetric key for distribution/sharing. – schroeder Mar 12 at 20:34
  • An explicit answer with RSA-KEM is here in Cryptography – kelalaka Mar 12 at 20:52
  • The fact that you are not writing it to disk is irrelevant for the cryptography part. (It might be relevant for the implementation) – user253751 Mar 13 at 10:39
0

PGP (Pretty Good Privacy) is the closest alternative to your proposal. This mechanism generates a strong random symmetric key for encrypting the data and cyphers that key asymmetrically.

So you have the symmetric key encrypted ONLY with the public key and then the data is ONLY encrypted with the symmetrical key.

Illustration of the processes of PGP, sourced from Wikipedia

My suggestion is: If you can reach both PC’s but in different instances of time, just cypher the block of data symmetrically (this is because you know the key and you won’t transfer it to nobody, so it’s safe). Elsewhere, PGP is a good option.

| improve this answer | |
  • So my service that is doing the encryption needs access to the symmetric key? Is there any way around that? For example - I encrypt data with key anyone can have and only some outside downstream service can decrypt it – Ryan Mar 12 at 21:20
  • Can PGP encrypt more than 1GB of data? – Ryan Mar 12 at 23:10
  • @Ryan as I see on this question, you will have no problem with 1GB, but I don’t know the maximum limits. Looks like it depends on the context. – J. Francis Mar 12 at 23:37

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