• caglararli@hotmail.com
  • 05386281520

Can you use GPG to decrypt and encrypt with a different key in one step?

Çağlar Arlı      -    8 Views

Can you use GPG to decrypt and encrypt with a different key in one step?

I have a file that will be encrypted at rest using GPG. I have the public and private keys for this file. I would like to send it to someone else. To do so, it must be encrypted using their (different) public key, so that they can decrypt it.

The easiest would be to:

  1. Decrypt with my key
  2. Write it to a temporary location
  3. Encrypt it with the other key

For security reasons, I can not write it to the temporary location because it won't be encrypted at that point. So, I would like to decrypt with my key and encrypt with the other key in one step, keeping the data in memory instead of writing it to a folder. Can this be done from the GPG command line?

I can't encrypt with my key and send them the public key to decrypt, it must start encrypted with my key and end up encrypted with their key.