TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Which way for storing client's RSA public key is correct?

1 pointsby airswimmerabout 3 years ago
For end to end encryption, client should pass his own RSA public key to server after every re-login. Client should have a dynamic RSA public key. Client may have the same credential but with different RSA public keys. Client will generate a RSA key pair randomly after start the app for the first time.<p>In other words, client will login from different devices at the same time.<p>For now all user sessions are stored in Redis server using Django(Python) framework as backend. Other user info are stored in PostgreSQL database.<p>I am thinking about 2 approaches for exchanging public keys between client and server.<p>*client sends his login credentials and public key to the server, then server will verify the credentials, then*<p>1. Server add client&#x27;s present pub key into his login session (redis server). Server will read client&#x27;s pub key from Redis server to encrypt data. Later on, server will pass the encrypted to client.<p>2. Server add client&#x27;s present pub key into PostgreSQL database with some columns, such as foreign_key to user_id, client_pub_key, valid_until, created_at. All the RSA key validation will be handled by the Django(Python) server. (I&#x27;m worried querying client RSA keys everytime from database will drag down the performance)<p>Which one do you think is modern, secure and fast for End-to-End encryption for user login from multiple devices?<p>Some better designs?<p>Appreciate your comments!

1 comment

speedgooseabout 3 years ago
If you don’t already have redis in your stack, stick with postgresql for now. You can always optimise later, but a proper machine (not a crappy public cloud VM with heavy throttled network storage) can handle a lot of SQL transactions before introducing redis is worth the effort.