What is a good way of doing this? Practical and Secure.
This is for a browser environment.
For example, let's say there are a few 100 independent messages of about 100 characters each that you want to send to the server independently and in an arbitrary order and you want to encrypt them with the same key before they are sent to the server because you don't want the server to have the contents of the messages. The next day the server may return some of those messages and the user should be able to decrypt them in the browser with the same key.
How would you do this?
What encryption scheme and what block cypher? Why? What library is recommended?
NOTES:
- This is in addition to HTTPS not instead of it.
- The user does trust the server to send a trustworthy encryption function and use it.