I’ve seen the “padlock” metaphor for public key crypto used a few times, but I feel like most people try to cram too much into the metaphor. My version only covers part of the metaphor, but I feel like if you want to know more you should learn about how it actually works.
A private key is like…well, a key. You keep it to yourself, make a backup copy and keep it somewhere safe no one will find it, and so on. The only difference is this key is an order of magnitude or two more complicated than your typical door key.
The public key is more like a lock than a key. You can give anyone a copy of this “keyed-alike” padlock, they can lock up their box and put the padlock on it and it will magically seal it away forever… or until you come along with the key.
The key used to open the lock and the pattern that the lock looks for to know whether to open are actually so complicated that they probably could never be “picked” or hacked through. Like magic!
A fun afterthought: this metaphor extends to a few other concepts.
- A type of padlock could be manufactured which has a “master key”. This means that it would work exactly the same as the above metaphor, but there would be another key that could open any of the boxes made with that type of padlock. This is usually what people are talking about when they discuss a cryptographic “back door”, and creates the same inherent issue that a physical master key creates — the master key can be lost or stolen.
- A type of padlock could be created which requires more than one key to unlock. A common example is a lock which takes three keys at once. You create five keys, give them to each of five friends, and then at least three of them would have to agree to unlock the thing you locked in the box.
This metaphor does not cover the concept that a private key can be used to sign a document, to indicate its authenticity. I think the metaphor of a signature is good enough one for that concept.