0

while coding a simple to-do list app enhanced with (true) end-to-end encryption as a coding exercise, I was wondering if the server-side API code changes from a plain text storage (excepts passwords) to an end-to-end encrypted app.

Indeed, if the data is truly E2EE, everything should be happening on the client side and the server just takes care of storing and retrieving the encrypted data. The server should not treat incoming data differently if it is encrypted or not, should it?

That means that the same server and the same server-side program could be used by an E2EE client or a normal (plain text) client. Indeed, the client could be sending encrypted data or not, the server would just store it and send it back when the user asks for it. It is then up to the user to decrypt the data if they had encrypted it.

That makes me asks how can a server-side application enforce his user to use E2EE?
Can a server know if incoming data has been properly encrypted?

8
  • What exactly do you mean by "end-to-end encryption"? Are you talking about two users communicating via your server?
    – user163495
    Oct 12, 2021 at 19:45
  • No I just mean that a user encrypts his to-do list tasks (using symmetric or any type of encryption) for example and retrieves them later
    – gruvw
    Oct 12, 2021 at 19:47
  • 2
    This is not E2EE, this is client-side encryption. Your to-do list manages all, which data where? It is like a simple file system; first, the list of to-do lists with their name is requested from the server, then decrypted on the client-side, now use select one of the to-do lists, now request that one from the server and decrypt, and so on...
    – kelalaka
    Oct 12, 2021 at 20:06
  • ok so E2EE requires sender and receiver to be different otherwise it is called client-side encryption? But if the users can share lists between each others, then it becomes E2EE, doesn't it? The second part of the question still holds: how could you enforce client-side encryption ?
    – gruvw
    Oct 12, 2021 at 20:10
  • Sharing is a different aspect. A user might not prefer to give the master key to the others, so, for each table you need to use a different key, and you can send this key (RSA-KEM) and the encrypted to-do them to decrypt... Very similar how you share passwords via password managers, see 1password. Now we are out of your question...
    – kelalaka
    Oct 12, 2021 at 20:19

2 Answers 2

1

You seem to fundamentally misunderstand what "end-to-end-encryption" means

"End-to-End Encryption" is an approach different to "Client-Server Encryption", and is relevant when users want to communicate with each other, without the server knowing what they are communicating about.

Client-Server Encryption Explained

Alice uses the amazing service "example.com" to send a message to Bob. Alice encrypts the message on her end and sends it to example.com. The server then decrypts the message, sees that it belongs to Bob, and encrypts the message again, sending it to Bob.

This means that the server at "example.com" can see the content of the message. This can be a problem for Alice and Bob, if, for example, they live in a country where the government is known to spy on its citizens. It is possible that the government forces the owners of "example.com" to screen all messages for specific keywords and report all messages, including sender, recipients and contents to the government.

While a Client-Server Encryption model still protects against attacks "on-the-wire", it doesn't protect against attacks that compromise the server.

End-to-End Encryption Explained

Alice uses the new and improved amazing service "foobar.com" to send a message to Bob. "foobar.com" uses end-to-end encryption, instead of a client-server model.

Alice begins by signing her message with her private key, then encrypts the message with Bob's public key. Alice then encrypts that message again via TLS and sends it to the server. All the server can see is that it is a message from Alice for Bob, but not the contents. The server then encrypts the message again via TLS and sends it to Bob. Bob is now able to decrypt the message with his private key and verify that it is really from Alice, by verifying her signature with her public key.

This scheme can also be modified slightly, by removing Alice's signature and thus making it more difficult for an adversary intercepting the messages (and possibly forcing Bob to decrypt his messages) to see that Alice is the original author.

The advantage in this model is that it becomes much more difficult for a nation-state actor to do widespread surveillance. While it is not impossible for them to attack high-value targets, simple keyword searches as described above are not feasible anymore.

2
  • 2
    @Gruvw doesn't encrypt for the server, but against it. That's not client-server encryption, but end-to-end-encryption with both ends being the same user.
    – Haukinger
    Oct 13, 2021 at 5:57
  • Indeed, I am not confused about client-server encryption... I understood that well
    – gruvw
    Oct 13, 2021 at 11:08
1

The server should not treat incoming data differently if it is encrypted or not, should it?

Yes, for the server it doesn't matter in this scenario, as long as the required meta data is not encrypted. Meta data is needed for the client to get the data back (like "give me items for user xy" or "give me item #435") if you don't want to require each client to always download all data.

Is the server able to know if a message has been encrypted in order to refuse storing a non-encrypted message?

The server cannot say whether a given text is plaintext or actually cleverly encrypted. Even if the server requires a specific encryption scheme, it cannot distinguish if a text has been encrypted or if, by chance, it looks like it has been encrypted.

2
  • what about the second part? Is the server able to know if a message has been encrypted in order to refuse storing a non-encrypted message?
    – gruvw
    Oct 13, 2021 at 11:09
  • @Gruvw no, not really
    – Haukinger
    Oct 13, 2021 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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