I'm developing an application with multiple clients and one server. All clients will have the same hard-coded Curve25519 key pair as well as the server's public key. The server will have its own key pair as well as the clients' public key.
The idea was to allow communication between server and clients without any concern that the data from one client could be intercepted and decrypted by an attacker possessing the client key pair, nor could they originate messages that appeared to be from the server in order to control other clients.
I'm using libsodium and the
crypto_box functions, and noticed that the following scenario works, which really puzzles me:
Alice has a key pair, pKa and sKa.
Bob has a key pair, pKb and sKb.
Each also have each other's public key (pKa and pKb)
Alice wants to send a message to Bob, so she passes pKb and sKa to
Bob can decrypt the message by passing pKa and sKb to
However, Eve has a copy of Alice's key pair and intercepted the outgoing message. She uses
crypto_box_open and passes in pKb and sKa, the same keys that were used to encrypt the message. This yields the plain text message. She changes the message, re-encrypts it, and sends it on to Bob.
I'm relatively new to crypto, so I'm sure I must be doing something wrong or just misunderstanding the application of the technology. If someone could help me out, that would be awesome.