After watching this video explaining PKE with tennis balls (interesting), it left me with a few particular questions that I'm having trouble finding answers to:

  • I assume that they keys used to unlock the padlocks are the Sender's and Receiver's public keys; if that's the case then does each endpoint in PKE have their own public key?
  • If the public key is "public" anyone can known it, then how does it secure the sending of the private key (if anybody could open the padlock and access the private key)?
  • In a real networking scenario, what does the tennis ball represent? TCP packets?
  • Can the public keys (which open the padlocks) be discarded after both parties have the private key?
  • How does each party generate their public key? Who generates the private key? How are these keys generated?

Thanks in advance.

  • First things first: forget everything you saw in that video....
    – tylerl
    Jun 29 '12 at 6:01

That video is misleading on several fronts. What you are seeing there is actually a Diffie-Hellman key exchange in progress. The so-called "private key" is not really a private key in the sense of PKI. The tennis ball represents an encrypted message and when decrypted contains what they label as the "private key" but should have labeled as "secret key". The locks represent a message encrypted with a public key, and the rubber gloved hands have (unlabeled) keys which unlock those locks representing the true private key.

In public/private key systems like RSA, there are two keys: the public key and the private key. Each key is represented by a number. However, due to various mathematical concepts surrounding prime numbers, their scarcity, and the extreme difficulty of determining how to factor large numbers composed of prime numbers, one person can hold the private key (and NEVER expose it publicly) while allowing the public key to be distributed as freely as they wish.

Fundamental to public/private key cryptography is the property of asymmetry. Only the private key can decrypt information encrypted by the public key. Because the public key is known to everyone, this means anyone can ENCRYPT a message destined for the holder of the private key. However, only the private key holder can decrypt it.

Furthermore, public/private key crypto also has the property that the holder of the PRIVATE key can sign a message. You might see many questions asking whether one can "encrypt with the private key". "Encrypt" is not the right word because the confidentiality of the message cannot be guaranteed. Instead, the term "sign" is used and it has a very specific meaning: only the public key can verify the signature. This means that a holder of a private key cannot claim they did not author the message. This is known as non-repudiation and is important when ensuring that a message was not altered.

If you wanted to make a video that discussed the fundamentals of public/private key encryption using the same props as in the video, then you'd need to do the following:

  • Give out copies of the lock to anyone who asks
  • Tell them to put a message into the tennis ball and lock it and send it to you
  • You can then unlock the lock on the tennis ball

The analogy is weak, however, because locks can be picked, opened, and reverse-engineered. Private keys can be "picked", but it might take tens of thousands of years of computing time to do it which is out of reach of ... everyone?

EDIT: I should mention that Diffie-Hellman is very important as a mechanism to distribute what are called "symmetric" keys. Because of their asymmetric properties, public keys can be distributed freely in the clear without any issues. However, because a symmetric key is used for both the encryption and decryption, you can't simply shout them across the room. Their distribution has to be very tightly controlled. Diffie-Hellman uses public/private keys to protect the distribution of the secret symmetric key.

As a matter of practicality, asymmetric keys are slow and cumbersome to encrypt large amounts of data. Symmetric keys are much faster. So generally what happens is that the symmetric key is used to encrypt bulk data, and must then be transmitted to the receiver to allow them to decrypt it. Public/private keys are used in Diffie-Hellman to exchange this symmetric key. The symmetric key can be considered a session key and need only be transmitted once or as-needed depending on if any expiration policies are in place.

  • Wow - fantastic answer (+1). So is this "secret key" the message that is encrypted, or is it yet another key for decrypting the message? If the latter is the case, then if I understand your answer, asymmetric public/private keys are used for transmitting symmetric secret keys, which are then in turn used to encrypt/decrypt messages. Yes, no? Thanks again!
    – zharvey
    Jun 28 '12 at 17:55
  • @zharvey, I've added a section at the bottom discussing the practical uses of symmetric vs. asymmetric keys for crypto work. The symmetric key is usually randomly generated, but it can, in some cases, be derived from input (eg. derived from a password -- not the password itself). Jun 28 '12 at 18:01
  • 1
    Worth pointing out: DH isn't a way to distribute a pre-existing key, it's a way to generate a new shared key in such a way only the two participants know what the new secret is. It's called a "key exchange" not because you're exchanging keys, but because it's an exchange that results in a key. Also, DH usually isn't used in SSL, though it's supported by the standard.
    – tylerl
    Jun 29 '12 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.