Cryptography of the process of writing (encryption) and solving (decryption) codes. Just as TCP enables reliable transmission over an unreliable network, cryptography enables verifiable, secure transmission over an insecure network.
In Unit 3, you saw some methods for coding messages before, and you looked a bit at some ideas about security and public key. You'll now look at a general method for coding messages that shows how it's possible to let everyone know what your coding process is while still making the decoding process very difficult to figure out.
Symmetric cryptography, uses the same secret key to encode and decrypt a message. Symmetric cryptography has been around for thousands of years. The trouble with symmetric cryptography is: how can we keep the key secret?
Public key (asymmetric) cryptography was created by mathematicians in the 1970s. It uses two different keys for encryption and decryption, and knowing the encryption key doesn't let you figure out the decryption key.
When you make a secure HTTP connection (the URL starts "https://" and a lock icon appears in the browser's URL bar), the browser uses a protocol called Transport Layer Security (TLS) or an older version called Secure Sockets Layer (SSL) based on public key cryptography. The site to which you're connecting sends its public key, and your browser uses it to encrypt whatever information you send (such as your password for that site).
encode () with ()
that accepts a text string (in the first input slot) and a function (in the second input slot) and encodes the text string message using the function provided. (Tips below.) Like this:convert message () to unicodelist
block that converts a text string (the message) into a unicode list so that you can perform the function on the numbers in the list. Using map
and split
.convert unicodelist () to message
block that converts a unicode list into a text string so that you can convert the output of the function back into encoded text. Use join
and map
encode () with ()
block that translates the input message into a unicode list, performs the inputted function on each unicode number in the list, translates the numbers back into letters, and reports the encoded message. Use convert message () to unicodelist
, map
, and convert unicodelist () to message
.decode () with ()
block that uses your inverse function to decode the output of your encode
block.Cryptography uses mathematical ideas. The security in public key encryption relies on choosing an encryption key that is a difficult function to invert (undo). These one-way functions offer security because
Sending a secure message to Alice:
To send secure messages back and forth, Bob and Alice will both need to post their public keys and keep their inverse functions (their private keys) to themselves.
In order to work properly, a cryptographic function has to be easy for the private key holder to invert, but hard for anyone else to invert. How do we know what "hard" means? For example, current cryptographic methods rely on the difficulty of finding prime factors of very large numbers. There's no proof that someone won't come up with a fast way to do that, but people are pretty confident about it because the problem has been well studied by many mathematicians. (On the other hand, when quantum computers become practical, factorization will be easy, and new cryptographic methods will be needed.)
What makes it possible for mathematicians to study the difficulty of breaking Internet cryptography is that the method used—the cryptographic function—is openly published. This may seem strange; if you want to keep secrets, shouldn't you keep the technique secret, too? But secret algorithms can have weaknesses that go undiscovered until some bad guy exploits them. Open standards allow an algorithm to be studied before it is used in practice.
Public key cryptography doesn't solve all the problems, because someone might publish a fake public key pretending to be Alice. Then someone might accidentally encrypt their message for Alice using the faker's key, and then the faker can read the message. In practice this is partly fixed by relying on trusted third parties, called Certificate Authorities, to issue public keys. But it is possible for anyone to set up a Certificate Authority! (In your browser's security options you can see all of the CAs that it trusts. Mine has just over 100 CAs, including governments, companies I've heard of (e.g., Microsoft), and companies I know nothing about (e.g., Thawte). I trust them because Firefox told me to, and I trust the Firefox developers.)