Given: some data (D) encrypted with the key (K), which results in the encrypted payload (E). Is it possible to send E (along with anything else required) to a server to be stored – and later verify that K was used to encrypt the original data resulting in E, without sending K in plain-text form?
The purpose of this is that a user who does not know the original data wants to have access to it and only knows K (it was provided to them). They need to show the server that they know K was used to encrypt the data before the server will return E back to them for actual decryption. Obviously this entire process should not reveal plain-text K to the server or be sent over the network. So that anyone watching the network or sitting on the server does not get free access to K.
One possible solution I came up with is to send a locally hashed version of K with E for storage on the server which can then be verified against another locally hashed version of K later. If the two hashed values of K (the one sent in the request, and they one stored on the server) match, then K was correct as far as the server is concerned.
Can you see any problems with the above solution or can suggest a more secure approach?
Edit: In this hypothetical system, users are anonymous, so user authentication cannot be part of the solution. A user will simply need to provide the server with some form of token showing they have knowledge of what K is. If correct, the server will reply with E, if incorrect, it will return nothing.