security - Authenticate public-key which is coming from a database -
i wrote small chat application, users can write each other messages:
- on first login, user generate public/private keypair, derived users password.
- the public-key sent server (database).
- if user (a) wants write user (b) message, user encrypts message public key of user b , sends server (and server send user b).
but what, if database-access change public-key of user b in database? attacker can read messages.
is somehow possible authenticate public key in database , make sure, not changed , 100% belongs user b?
so you're trying protect against scenario attacker has control on server , server cannot trusted. since can't trust any information server, cannot use directly in form of verification either. server can relegated being dumb transport, , verification needs happen directly against other peer.
being able exchange key out-of-band lot here, meaning can somehow facilitate direct peer-to-peer exchange of key. since difficult trust identity of random remote peer on general internet, you'd need employ strategy threema: can remote peer's public key anonymously, relationship peer not verified then. if you're able meet in person , exchange/verify keys physically scanning each others qr codes key trustworthy.
to facilitate sort of key exchange remote peer via untrustworthy server, you'd need implement diffie-hellman key exchange; server can facilitate communication, have no visibility data being exchanged. have happen both peers being online @ same time (or it's slow offline back-and-forth), may problematic in practice depending on use case.
Comments
Post a Comment