Encryption is the process of scrambling data so that only somebody with the right authorization (i.e. the right key) can unscramble the data.
Unscrambled data is sometimes called plaintext or unencrypted data. Scrambled data is sometimes called ciphertext or encrypted data.
This is a very high level discussion of the the topic, which does not go into any kind of detail. There are many discussions that get into more detail; one good one is Peter Gutmann’s “Encryption and Security Tutorial”: http://www.cs.auckland.ac.nz/~pgut001
Symmetric encryption: the same key is used to encrypt and decrypt the data. Applications:
- Encrypting your hard drive
- Many kinds of Wifi passwords
- Internal transmission of data once a communications link has been established with public key cryptography
Disadvantages of symmetric encryption:
- You have to trust the people who have the keys
- Distributing the secret key securely is hard
- This is useful for encryption but not for confirming identity
Public Key Encryption
Public Key encryption: there are two keys. One key (it doesn’t matter which) can encrypt the data, and the other key is used to decrypt it.
By convention, one key is called the private key. This key must be kept secret from everybody but the user. The other key is called the public key, and everybody is allowed to know it (even bad people).
Public key encryption is used in a few different ways:
Encryption: Say Herman wants to send Jeff a secret message. Then Herman encrypts the data with Jeff’s public key and sends the encrypted data to Jeff. Then Jeff can decrypt the data with his
private key, but nobody else can (because Jeff’s private key is secret).
Digital Signatures: Say that Donna wants to prove to Chris that an important electronic document came from her, and that it was not modified somewhere along the way. Then Donna encrypts the data with her private key, and sends the encrypted data AND the unencrypted document to Chris (or to anybody else).
Now Chris takes Donna’s public key and uses it to decrypt the encrypted data Donna sent. He now has two copies of the unencrypted document, which should be identical.
In this case the encrypted data is called a signature.
Certificates : Say that Kalin wants to confirm that he is speaking to George and not an imposter. Say that for some reason Kalin trusts George’s public key. Then Kalin can send a secret message to George encrypted with George’s public key. George then decrypts the message, changes it in some known way, encrypts the changed message, and sends it back to Kalin.
The difference between this and signatures is that the most important part is George’s identity, not the content of the message.
Public key cryptography has many applications:
- “Secure” https web browsing using SSL (Secure Sockets Layer)
- SSH (secure shell) communication
- VPN (Virtual Private Network) technology
- Signing operating system packages and drivers
Disadvantages of public key cryptography:
- How/why do you trust public keys?
- Public key cryptography is generally slower than symmetric cryptography
- Untrusting (revoking) private keys that have been revealed is awkward
Secure Web Browsing
Secure (https) web browsing uses technology called SSL (Secure Socket Layer), or TLS (Transport Layer Security, which is a new version of SSL).
SSL depends on certificates to identify the websites you are connecting to. This is managed using a public key infrastructure (PKI):
- An entity called a certficate authority has a certificate that is trusted by your web browser
- The website you connect to has purchased a certificate from the certificate authority. This is an affirmation that the certificate authority trusts you (in addition to taking your money).
- The certificate authority uses its private key to make a signature of your public key.
- Your web browser checks the signature of the secure website using the certificate authority’s public key to confirm the trust.
- Then your web browser starts secure communication with the website.
Sometimes you see certificate warnings from websites. Usually these are bad. They can occur for a number of reasons:
- The website is pretending to be a different website. This is the dangerous situation.
- The website’s security certificate does not match its name, which is often but not always bad.
- The website is using a self-signed certificate, which means that it has not been trusted by any certificate authority that the web browser trusts.
- The certificate has expired (or your clock is wrong).
Unless you know that a certain website will fail a security check, and you know why it will fail, you should avoid using “secure” websites with bad certificates.
Note that a website with a bad website will still allow “secure” communication — you just will not be able to trust the party you are communicating with!
Trusting Public Keys
The question of “what keys to trust” is hard. Here are a few approaches used.
For a good discussion of this, see: http://www.freedom-to-tinker.com/blog/sjs/web-security-trust-models/
Lists of Certificate Authorities
Web browsers manufacturers keep a list of certificate authorities that they trust, and then any website with a certificate signed by any of those certificate authorities is trusted.
How does this list get chosen?
- Mozilla (the organization that creates the Firefox web browser) publishes its criteria: http://www.mozilla.org/projects/security/certs/policy/
- The CAcert organization (http://cacert.org) suggest that certificate authorities need to go through an expensive WebTrust audit to be considered for inclusion: http://http://www.webtrust.org/
This trust is not always justified. There have been cases where certificate authorities have had their statuses revoked when their operations were compromised. The “DigiNotar” example is one case: http://en.wikipedia.org/wiki/DigiNotar
Web of Trust
This is an alternative idea that is used with PGP keys. The basic idea is that of a social network: other people sign your public keys to affirm that they have verified your identity, and you sign theirs. (You can also assign a trust score to indicate how much you trust the person/entity in question.)
Now if you want to use an unknown public key, you look at the web of trust. If you can find a path of trust from that public key to you, you might use the key. Otherwise you might reject it as untrustworthy.
Currently, the Debian project uses the web of trust for its developers.
Some people use encryption for their e-mail:
- They digitally sign their e-mail so that others can confirm that their e-mail is actually theirs
- Sometimes they encrypt e-mail they send to others
There are two common schemes for e-mail encryption:
- S/MIME, which uses certificates similar to the ones for SSL
- PGP/GPG/OpenPGP keys
Unfortunately, support for email encryption is abysmal, especially for webmail. (How does your webmail get access to your private key without compromising it?)
Desktop client support for e-mail encryption exists but is not widespread:
- Mozilla Thunderbird + Enigmail
This work by KW Freeskool is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.