0

Question

The question is in the title, but here are more details:

I want my server to have an upload endpoint (single POST for small data or multipart for larger data) where clients can upload data.

However:

  • Clients can upload only encrypted data that I can't possibly decrypt (only the clients know the encryption key).
  • I want to be able to verify that the data I receive is in fact encrypted like that.
  • Ideally (if possible) the proof-of-encryption is part of the authentication process so any significant uploading (e.g. of megabytes) can't even begin without such proof. Alternatively, I'm okay with just checking the data afterwards and deleting it from the server if the proof-of-encryption fails (not ideal as I temporarily store unencrypted data, but acceptable).

Solution idea (disregard if I'm on the wrong track)

I think the first step is to require the client to grab a nonce from the server, but then I got stuck. Is it somehow possible to

  • Combine the client's passphrase with the nonce client side, and
  • Verify server-side that the data I receive was encrypted with the nonce combined with the (unknown to me) passphrase?
4
  • what kind of software client do your clients use? A native app (e.g. mobile or desktop app) of a web browser based one (e.g. SPA)?
    – user284677
    Dec 11, 2022 at 17:11
  • @Spyros I had a website (e.g. SPA) in mind, but what difference does it make? The endpoint is just a standard that anybody can use, no matter the use case I had in mind.
    – XMR-XMR
    Dec 12, 2022 at 10:22
  • it depends on the level of assurance you seek to achieve. For example, a native app that is created by you, can offer some level of assurance that the submitted data will be encrypted (given that you don't expect your clients to reverse-engineer it). However, if you require an absolute proof at the endpoint side, then things differ
    – user284677
    Dec 12, 2022 at 10:29
  • Do you have something in your mind like GPDR? Encrypt yourself regardless of the client...
    – kelalaka
    Dec 14, 2022 at 18:40

2 Answers 2

2

I don't think it's possible to verify before upload. You in essence said it yourself with "Verify server-side that the data I receive was encrypted with the nonce ...".

You can run entropy checks on the uploaded data. Common tests include:

  • Chi-square
  • Arithmetic Mean
  • Monte Carlo Value for Pi
  • Serial Correlation Coefficient

These are generally sufficient to differentiate encryption from compression.

Nothing I'm aware of will indicate weak or trivial passwords short of brute force checking, which begs the question of whether you want to try.

0

Having a proof (being able to verify) that clients encrypt the data before they sent them to your endpoint, means that you have full control of their devices and can verify that clients encrypt the data, without them being able to tamper with the process. However, this is not generally the case, so it cannot be done.

Being able to prove that data are encrypted once you receive them at your endpoint is a very difficult task. You can use statistical methods (like the ones proposed by user10216038) but you won't get a definite proof from them.

Another approach would be to simply encrypt the data that a client sends, upon arrival to your endpoint. You can then use a key management approach that will allow you to do it without keeping the encryption key in a form that can be used to decrypt the data (e.g. have the data encrypted with the key, then store the key encrypted with the public key of the client).

You must log in to answer this question.

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