A simplistic explanation of public-key cryptography
This is a transcript of an irc conversation.
<MJ94> Hey, can someone explain public keys, encryption, decryption, public keys, and their use to me in idiots terms please? I don’t feel like Googling.
<MJ94> Please?
<lietk12> Erm. I can give a very simplistic and watered down and probably inaccurate way of thinking about it.
<MJ94> Shoot.
<MJ94> ![]()
<lietk12> Okay.
<lietk12> Let’s say Alice has a letter she wants to send to Bob.
<lietk12> (It’s a love letter
)
<MJ94> Always alice and bob ![]()
<MJ94> lietk12: Aww.
<lietk12> However, she doesn’t want Eve reading it and blabbing it to everyone.
<MJ94> Young love.
<MJ94> Damn eve.
<MJ94> Where’s adam?
<lietk12> (Also, she doesn’t want Eve to mess around with the letter to make it a hate letter
)
<MJ94> How would Eve GET the letter?
<lietk12> Let’s say she works at the post office ![]()
<lietk12> (Because, y’know, a hacker could tap into your internet connection)
<MJ94> I thought encryption was online, but OK.
<MJ94> Oh I see.
<lietk12> Yup.
<lietk12> So, the solution is to make it unreadable by anyone who doesn’t know how to make it readable.
<MJ94> I’m not encrypting my science notes ;P
<MJ94> I see.
<lietk12> You could think of it as putting a message inside a lunchbox, and locking the lunchbox.
<lietk12> (let’s assume that it’s a combination lock)
<MJ94> But then I’d be hungry.
<lietk12> Heh.
<MJ94> And very paranoid about lunch.
<MJ94> ![]()
<MJ94> Continue ![]()
<lietk12> Anyway, Alice only shares the combination with Bob.
<lietk12> So only Bob knows.
<MJ94> Never share passwords or combos ![]()
<MJ94> Cool.
<lietk12> However, how does Alice make sure that Eve isn’t eavesdropping on Alice and Bob when Alice tells Bob the combination?
<MJ94> Oh yes, how?
<lietk12> (Hint: Alice can’t)
<MJ94> Oh lietk12.
<MJ94> Lemme guess.
<MJ94> She can’t?
<lietk12> So, Alice decides to put 2 combination locks on the lunch box.
<lietk12> One is a lock which only she knows how to open.
<MJ94> Huh…
<lietk12> Err..
<MJ94> I see.
<lietk12> That’s a bad analogy.
<lietk12> Let me put it another way:
<MJ94> Err?
<lietk12> Alice puts on a combination lock which she can open using a key.
<MJ94> ok.
<lietk12> This is a special lock–to be able to close the lock, you have to know a combination.
<lietk12> However, that combination will not open the lock.
<lietk12> Thus, if Bob knows the combination, he can only close the lock (i.e. send messages to Alice)
<MJ94> I see.
<lietk12> Eve can also send messages to Alice, but she (like everyone else) cannot open any locks.
<lietk12> Thus, Eve cannot tamper with Bob’s message.
<MJ94> I see ![]()
<lietk12> So, Alice advertises her combination (e.g. on the signature of a forum account)
<lietk12> Thus, everyone can send messages to her, but only Alice can open the boxes with messages.
<lietk12> (Alice has an infinite number of boxes which people can put messages in)
<lietk12> The combination which everyone has access to is the public key.
<lietk12> Alice’s personal physical key (like what you use to open a door) is the private key.
<lietk12> (Alice shouldn’t share her private key, or else someone could read all messages sent to her!)
<MJ94> Fail ![]()
<lietk12> So, encryption is done in the following way:
<MJ94> Cool! How do I start?
<MJ94> lietk12: Yes?
<lietk12> 1. Find the combination to close the lock.
<lietk12> 2. Write a letter.
<lietk12> 3. Put the letter in the box, and close the lock with the combination.
<lietk12> To decrypt it:
<MJ94> I see.
<lietk12> 1. Find the box.
<lietk12> 2. Use the door-type key to open it.
<lietk12> In computing, typically keys are done with OpenGPG (I honestly have no idea how it works, and I’ve never needed to use one).
<lietk12> Certian places will use a ssh key thing (not sure how that works either, but the principle is the same)
<lietk12> *Certain
* Mike||gone is now known as Mike_lifeguard
* um|U (~wthww@cpe-98-157-158-57.ma.res.rr.com) has joined #clueirc
<lietk12> Oh, another wrinkle:
<lietk12> How does Alice figure out her combination?
<lietk12> She has a machine. Alice puts her physical, door-type key into the machine, which spits out a unique combination based on it.
<lietk12> (Like, you can’t get that combination from any other type of key)
<lietk12> *from any other key
<lietk12> Let’s imagine a world where everyone has this machine, and it works the same way for everyone (it uses the same method to generate the key).
<MJ94> Yep.
<lietk12> Thus, only the person who has Alice’s key will generate a public key that matches hers.
<lietk12> What if all doors had a small version this machine?
<lietk12> If you insert your key, it’ll generate a public key. Let’s say Alice makes her door-lock only accept her public key and Bob’s public key.
<lietk12> Thus, Bob’s and Alice’s key will work.
<lietk12> Eve’s won’t. Eve can’t bypass the lock–the only way to enter a public key is to put in your physical, door-lock-type key.
<MJ94> I see.
<lietk12> This is kind of how password hashes and ssh public key authentication works.
<MJ94> Well thanks!
<lietk12> No problem.






