Currently I am developing a web application that implements a message archiving service. Required is that messages are not readable by the developer / sysadmins, and a nice-to-have would be transmitting the messages end-to-end encrypted. The messages should be readable by all people in a 'business'. Messages that should be archived come in from external sources such as api's or email. These external incoming messages should be considered classified. users should be able to log in from any browser.
In my current test implementation upon creating a 'business' an RSA Keypair will be generated. The public key will be saved in the database associated to the 'business', and the private key will be encrypted using a hash derived from the users password, and stored associated to the user. When other users are added to the business, the decrypted private key of the logged in user will be encrypted using the new users password-derived hash and stored with the new user.
Incoming messages will be encrypted by the business its public key.
When querying messages these will be decrypted by the users private key (the private key will be the same for all users in the business, except they're encrypted with a different password-derived hash). So when a user logs in the password will be used to get the derived hash, decrypt the public key and store it in a server side session. From then messages can be decrypted and served.
The only problem is: by reading the session files, sysadmins are still able to decrypt messages of logged in users. Is there any protocol to solve this?
I have been thinking of client side decryption aswell (by sending the users encrypted private key to the browser, deriving the key from the password in the client side, decrypting the private key using that, and saving the decrypted privatekey temporary in localstorage and decrypt messages from the api using that decrypted private key on the client side, but is storing a decrypted private key in the browser secure?