I am hoping to be able to do this:
- Encrypt a string in the browser, with a password from the user
- Send that string to my server
- Allow anyone to request that string from my server
- The string can be decrypted by someone with the password
- Anyone without the password should need millions of dollars/years to decrypt the string
I've found this thread which uses AES to encrypt and decrypt a password. But testing it with my data, the decrypt function runs in 50 milliseconds. That'd be 1,728,000 password attempts in a day, just in the browser. If someone really wanted to break that encryption, I'm sure it'd be doable in short order.
My second intuition says that I should keep it on the server behind a password. You send the ID of the data you need, and the password, and it sends back your encrypted data. This solves the problem of #3, but I could still decrypt the data if I really wanted to.
Is there a way to do this were I, the server runner, doesn't need to be trusted? Assume the user can trust/validate what data they're sending to the server, and how it's encrypted in the browser.