Public Key Encryption #### Introduction If you are at all interested in security, you must read _The Code Book_ by Simon Singh. One of the finest books I've ever read. I will paraphrase his thoughts on public key encryption here. _code_: "Jupiter" implies "Attack at dawn" (Use Noel Becar's father example) _cypher_: replaces letters not words. "xyz" computed/encrypted from "cat" via simple substitution cypher c->x, a->y, t->z. DES: Data Encryption Standard (1976). Converts plain text into cyphertext using a key. Bigger the key, harder it is to crack. 56bit DES. #### Key distribution problem The problem is how do you get the key to someone so they can decrypt the message you are sending. In the old days, they used codebooks that would specify the key rotation for which day etc... The problem is that those can be captured as in WWII submarine we nabbed. With computers: You can't call on the phone to tell someone the code, but it's better than emailing it in the clear. In person is best, but can still be overheard. Banks used to send couriers around with the keys in a locked briefcase! The development in the 1970's of a key distribution mechanism is a triumph! ### Key exchange The new strategy: "Alice wants to send an intensely personal message to Bob. Again, she puts her secret message in an iron box, padlocks it and sends it to Bob. when the box arrives, Bob adds his own padlock and sends the box back to Alice. When Alice receives the box, it is now secured by two padlocks. She removes her own padlock, leaving just Bob's padlock to secure the box. Finally she sends the box back to Bob. And here is the crucial difference: Bob can now open the box because it is secured only with his own padlock, to which he alone has the key." The problem is in the order of encryption operations for a computer. You must encrypt/decrypt by "last on, first off." This order problem breaks. Alice encrypts then Bob encrypts, but Alice cannot undo his encryption so she can decrypt hers. Even though this doesn't work for computers, it inspired Diffie and Hellman! They started looking at trap-door math (non-two-way functions like on then off of a lightbulb). One-way: mixing blue and yellow paint to get green cannot be undone by "unmixing". Given {3^x = 1} in modular arithmetic 7, what is {x}? Only way is to try all combinations of x looking for a solution. If you make 3 bigger, you really have lots to try out. That is why bigger "keys" are stronger. Bob and Alice agree to use {y^x} mod p and choose say {7^x mode 11}. Initially Alice and Bob agree on values for y and p. Almost any values are cool, but y Bob and yellow+crimson->Alice. This is the Diffie-Hellman-Merkle key exchange scheme. Great, but for email say, you both have to be at the compute to exchange the keys before you can send an encrypted email. ### RSA and public key encryption (Rivest, Shamir, Adleman) Must have a public key. Chooses two prime numbers p and q. Multiplying gives big number, which is the public key. To encrypt to Alice, get her public key and puts into general form of one-way function (also public). Bob now has a function tailored to Alice's key; just apply to Bob's text and send to Alice. Nobody can decypher it as it's encrpyted. How can Alice decrypt? Alice must be able to undo the one-way function. Rivest designed a one-way function so that it is reversible to someone who knows the values of p and q. Knowing p*q gives no clue to p and q w/o lots of work. p and q are the private key. Note that Bob himself cannot decrypt message he sends to Alice. Also, you don't have to both be online to exchange keys. You use DES on your drive to encrypt the private keys which are big primes. DES can encrypt with a passphrase you can remember. If you forget your passphrase, your done!