I make software for physics labs, and computers in the labs are exchanging all sorts of information with each other and with researcher's laptops, usually on a university network. I use ZeroMQ for most communication.
I'm working on using ZeroMQ's built in encryption to secure this communication in an upcoming version of my software.
ZMQ's security model is public key crypto based on CurveCP, and I'm following their "ironhouse" example with both clients and servers verifying each other's identity via each other's pubic keys.
The thing is though, that I don't really have well defined "clients" and "servers", the computers involved are more like 'peers'. And they can come and go at short notice, and it is not practical to distribute a new public key to every computer that a new person's laptop might want to talk to, or to distribute a new public key whenever a new raspberry pi that is set up to monitor some piece of equipment. Automating key distribution via some server and ssh is also something I can't really expect of the average physics lab.
But I think "here, copy this base64 string to your config file on every computer you want to be able to talk to each other, and treat it like the lab computer password" is a reasonable expectation.
To that end, can I give all peers the same private/public keypair, and treat that keypair (or at least the private key) as a preshared secret? Everyone having the same keys doesn't seem much different to everyone having the login password to the lab computers (which are also all the same usually), so long as the crypto doesn't require that two peers have different keys. Of course it's broken if someone leaks the keys, but that's no different to the lab computer passwords being compromised given that that gives everyone on the network RDP access - you have to change the keys and tell everyone in either case.
I don't have to have a single keypair - it's just slightly simpler. I could have two keypairs, and have each peer decide which to use based on which calls bind()
in zeromq and which calls connect()
- the difference is arbitrary in zeromq but is an already broken symmetry that could allow me to define by convention which peer uses the 'client' keypair and which uses the 'server' keypair. In either case I'd be distributing the same private keys to everyone, the only question is whether I distribute one or two.
I would have used symmetric crypto with a preshared key if it were an option in ZeroMQ, but it's not, and inserting symmetric crypto at the application level means some of the info ZeroMQ sends would not be encrypted (it prepends routing information and that sort of thing) and would also leave the applications vulnerable to replay attacks, since some ZeroMQ sockets are one-way and it doesn't give you access to the underlying TCP socket, so you can't do any sort of handshake to make the symmetric crypto use a per-session salt or whatever.
So, tl;dr is ot OK for peers to use identical keypairs in CurveZMQ?