• caglararli@hotmail.com
  • 05386281520

PGP encryption for the server based app

PGP encryption for the server based app

Here is context:

I am using PGP to encrypt messages in a chat web app. After going through some articles, I get brief idea how PGP works and here is how I am doing it with openPGPJs :

  • Client(web browser) generate the public/private key-pairs and send public key to server to store it.
  • Sender use receiver's public key to encrypt data and send it.
  • Receiver use their own private key to decrypt the message.

As a chat app I need to store all messages and decrypt them when user wants to see old message. decryption of messages need the private key. here the client is web browser which neither can store the private keys for long nor can keep them safe. so I decided to store the private key on web server. Now client(web browser) asks server for the private key whenever decryption of message needed.

Considering PGP an End to End protocol, storing private key on server is vulnerable. my question is:

  • How PGP encryption works for web based applications where client is not able to keep private key safe and confidential?

  • Is it Okay to store private key on server?

  • Is there any better way to do this?

Thanks for any suggestions.