I'm trying to create a solution to decrypt a file at rest on a server by sending an email to a given address and receiving a reply from that address. I'm struggling to see if its possible and haven't identified a methodology yet; so I'm writing to see if such a solution actually exists.

I don't wish to store an encrypted password on the server, I'd like to be able to derive it based on some exchange via email. Obviously no data sent or received via the email can give away any part of the secret. I've been thinking along the lines of leveraging the email sender signing the message (either s/mime or pgp) and using that signature as an input to generating the encryption key. (Assume the email public key part is available to the server) But I haven't hit upon a way to achieve it.

End result is that when some server process requires access to the encrypted file it sends an email. The recipient simply replies, signs the reply and sends. This is then sufficient for the server to derive the key previously setup.

So anyone know of a methodology or solution that implements something like this?

Many thanks.


  • $\begingroup$ Maybe you should look into the Signal protocol for how to establish authenticated confidential channels on a large-scale asynchronous medium. $\endgroup$ Nov 17, 2017 at 16:32

1 Answer 1


The email signature would not do exactly what you want, but should prevent a man-in-the-middle attack on performing a Diffie Hellman key exchange through email content.

Client requesting decryption:

Generate random private key $CK_a$
Generate public key $CK_b$
Email $CK_b$ to server along with information on file needing decryption


Generate random private key $SK_a$
Generate private key $SK_b$
Generate session key $X$ from $SK_a$ and $CK_b$
Encrypt information needed to decrypt using $X$
Email $SK_b$ and encrypted payload to client

Client: Generate session key $X$ from $SK_b$ and $CK_a$
Decrypt payload with session key, decrypt file

In this example the server is the one with the key to the file, swap server and client if you want the client to have the information for decryption, and the server to not. Other variants of this exchange exist, depending on where the file is located, and who should have access to the file, but since the file is at rest, it is already encrypted with a key that is not going to change.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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