We are trying to encrypt files in a manner that they can be completely secure in an insecure environment (like a public cloud). We're talking about military grade secure.

The data should be so secure in the public cloud, that the employees cannot access the files (insider threat) and no MitM can access the file.

Our initial idea was to make a VPN (OpenVPN) tunnel between the customer and the public cloud and encrypt the files exchanged using PGP (GnuPG).

Is this secure enough for this use case? We are dealing with PII.

P.S. is it possible to somehow split out trust for the private key on multiple servers on multiple split files on multiple cloud providers?

  • 2
    Military grade security is incompatible with a public cloud infrastructure.
    – A. Hersean
    Apr 25, 2022 at 12:25
  • The VPN and GPG usages you describe only protects data in transit on the public network. How do you plan to protect the stored data?
    – A. Hersean
    Apr 25, 2022 at 12:27
  • Also, this might be a XY problem. What are your trying to achieve? Why do you need to use a public environment?
    – A. Hersean
    Apr 25, 2022 at 12:30
  • @A.Hersean the stored data should be secured using PGP if that's possible. We want to achieve a secure communication of PII from the customer to our infrastructure. We want to use public cloud due to the fact that it supposedly uses higher security standards and we're not able to achieve these standards ourselves (high physical security etc)
    – Munchkin
    Apr 25, 2022 at 12:33
  • 1
    You have a problem with your threat and trust models. Address those first. If you consider the remote service insecure, then you shouldn't be storing secret keys or other brute-forcible items there in the first place. YTTMMV. Apr 25, 2022 at 15:09

2 Answers 2


I'm sure there's a few security professionals that can spin stories about "military grade" security.

So you want to encrypt data and process it with zero insider threat? What you're looking for is homomorphic encryption. That's a mean geanie, formulate your questions perfectly. But if something is ever decrypted in the cloud there is an insider somewhere with access to that running process/decrypted data (in the public cloud).

To be less hyperbolic, minimize insiders with access to a system, store keys in a KMS or HSM and store all values encrypted at rest. Clouds often have special pricing for HIPPA or military grade clouds. And hire a security consultant for the particulars if it means that much to you.


This is certainly possible using new encryption schemes.

See sample code below:

Alice wants to send a message to a Resource Server X. The resource server saves the encrypted data in the cloud and I presume this is your use case.

Alice fetches a shared key for X and encrypts the message to be sent to X. This message can be stored on the public cloud and no one other than the resource server can decrypt this message not even administrators.

var HEClient = new ASKClient("Alice Resource Login Token","Alice Resource Name", "Alice Resource Login Token Password"); 

This is how alice will fetch the shared key for X

var sharedkey = HEClient.GetPreSharedKeyByKnownName("X",UnixTimeStamp);

This is how alice will encrypt the message

var encryptedmessage = HEClient.EncryptMessageUsingSharedKey("X",<Encrypted Message>,<sharedkey>);  

Note here that internally the library also makes use of "Alice Resource Login Token Password" to encrypt the message.. This kind of encryption scheme is not currently available anywhere where the private passsword and shared key together is used to encrypt the message.

This encrypted message can be sent to the resource server. The resource server can download the shared key for alice by using the unix timestamp and save the shared key.

This encrypted message/file can be stored in the public cloud along with the shared key (What?? saving it along with the key, that's right, the shared key is useless since the encryption and decryption also needs the resource secret(password) to decrypt the message like shown below)

var HEClient = new ASKClient("Resource X Login Token","Resource Name", "Resource Password");  

Note here that the shared key of alice along with the resource password is required to decrypt the message

This is how Resource Server will fetch the shared key for X

var sharedkey = HEClient.GetPreSharedKeyByKnownName("alice resource name",UnixTimeStamp);

This is how Resource Server will decrypt the message

var decryptmessage = HEClient.DecryptMessageUsingSharedKey(<Encrypted Message>, sharedkey>);

You can search for this library in nuget: ASK Client Library ASK Client nuget


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .