We live in a society in which we interact with thousands of other individuals we don't personally know, yet we have to trust those interactions. Every time we use a credit card, for instance, we're relying on a network of anonymous people to ensure the payment we're sending is, in fact, made honestly and free of interference. Such invisible but essential transactions are made possible by the magic of public-key cryptography, the system that uses pairs of keys — one public, one private — to transmit messages securely between two parties who have no physical connection with each other.
Before showing how it works using an ingenious paint analogy, first consider how two strangers with no prior connection, Alice and Bob, can exchange secret messages. Alice puts her message in a box, padlocks it shut and sends it to Bob. Bob can't open it (not having the key to Alice's lock) but adds his lock to the box, returning it to Alice, who removes her lock and sends it back for Bob to remove his lock and open the box. Which might be fine, except someone could intercept the box, pick the lock(s) and read the message.
Math to the rescue! Turns out there are essentially "one-way" computations in math: easy to do (lock the padlock) but virtually impossible to undo (pick the lock). One such computation is multiplying two large prime numbers. This is easy to do but really, really hard to undo — that is, to discover the original primes from their product. We're talking very large numbers here, typically 600-digits long.
The paint analogy goes like this: Alice and Bob have never met, and any communication between them is subject to eavesdropping by Eve. They start by agreeing, via open communication, on a common paint color, say yellow (the "public key"). Each of them chooses a secret "private key" color — Alice chooses red, Bob chooses aqua. Each of them then mixes their "public" color with their "private" color — Alice gets orange, Bob gets blue — which they send to each other via open communication. When Alice receives Bob's mixture, she adds her own secret color to get olive (yellow + aqua + red) and Bob does the same (yellow + red + aqua). So now they have a common secret color, olive, that they can use to encrypt future messages.
Meanwhile, Eve knows the public color (yellow) and the two mixed colors (orange and blue), but it's virtually impossible for her to reverse-engineer these three public colors to deduce the two private colors. The analogy is that un-mixing the public colors to discover the two private colors is like unscrambling a huge number to find its original prime factors. In the language of mathematics, it's "computationally infeasible."
This cunning public-key-private-key system of securely sending private information over a public network was figured out in the 1970s by Ralph Merkle, Whitfield Diffie and Martin Hellman. Today, it forms the backbone of virtually all transactions requiring trustless verification between remote parties, whether we're talking spy networks, dabbling in stocks, trading cryptocurrency or swiping a Visa card. In the future, we'll see votes, deeds, car registrations, medical records — any information of value — verified over a blockchain that depends on this pubic/private key security so that strangers who have no reason to trust each other can rest assured: The trust is built into the system.
Barry Evans (email@example.com) wonders what happens if he chooses black for his private key color.