Keys
We commonly use the term "key" in day-to-day life. One definition of a key is a tool to open a locked door, where something is kept hidden from prying eyes. In the data world, the term "key" has a similar meaning. A key is used to protect information in various ways. For instance, a data key performs a similar function as a password used to protect a user account or a PIN (personal identification number) used with your ATM card to access your bank account. Normally, the longer the key, the more secure the protection it can provide; however, this is not always the case. The following three sections will discuss how keys are used and the two types of keying algorithms: symmetric and asymmetric.
Key Usage
In network security, keys serve a multi-functional process. For example, keys are used for all of these three critical VPN functions:
- Encryption
- Packet integrity checking
- Authentication
There are two basic types of keying solutions:
- Symmetric
- Asymmetric
The following sections will talk more about these two basic types of keying implementations.
Symmetric Keys
Symmetric keys use the same single key to provide a security function to protect information. For example, an encryption algorithm that uses symmetric keys uses the same key to encrypt and decrypt information. Because the same key is used to create and verify the security protection, the algorithm used tends to be fairly simple and thus very efficient. Therefore, symmetric algorithms, like symmetric encryption algorithms, tend to work very quickly.
Because symmetric keying is very efficient and fast, it typically is used in encryption and packet integrity checking. Some encryption algorithms and standards that use symmetric keying are: DES, 3DES, CAST, IDEA, RC-4, RC-6, Skipjack, and AES. MD5 and SHA are examples of hashing functions that use symmetric keying.
One problem, however, with symmetric keying is that the two devices performing protection of data somehow have to get the same key value. For example, if two devices, RouterA and RouterB, are performing DES encryption, and RouterA generates the symmetric key for DES, RouterB also will need this same key to decrypt information that RouterA sends it. There are two basic ways to accomplish this:
- Pre-sharing keys You can pre-share the keys, out-of-band between the two devices.
- Using a secure connection You can use either an existing secure, protected connection to send keys across, or create a new protected connection to send keys across.
This last option is a "catch-22" situation, because to have a secure connection, you need keys; and to share keys, you need a secure connection. Pre-sharing keys doesn't scale very well. Later in the chapter in the "Key Exchange" section I'll discuss ways of sharing keys, dynamically, in a secure fashion between two devices without having to resort to a manual-based pre-sharing method.
Asymmetric Keys
Unlike symmetric keying, where the same key is used to create and verify the protection information, asymmetric keying uses two keys:
- Private keys
- Public keys
The private key is kept secret by the source and is never shared with any other device. The public key is given out to other devices. You can't randomly choose any value for the two keys; instead, a special algorithm is used to create the keys, because they need to have a symbiotic relationship with each other to provide protection.
Asymmetric keys are used for two basic security functions:
- Encryption
- Authentication
The following two sections will discuss each of these functions where asymmetric keying is used; the next two sections will discuss advantages and disadvantages of asymmetric keying, and examples of where asymmetric keying is used.
Asymmetric Keying and Encryption
Asymmetric keys can be used for encrypting data. In such cases, a device first creates a public/private key combination. The device, say RouterA, then gives the public key to a remote peer, like RouterB. RouterB uses the public key to encrypt any data that needs to be sent to RouterA. With asymmetric keying, only the related private key will be able to decrypt the information; therefore, RouterA will use its private key to decrypt it.
Likewise, for RouterA to send data to RouterB, RouterB would generate a separate public/private key pairing and share the public key with RouterA. RouterA then would use this second public key to encrypt data meant for RouterB and RouterB would use the related private key to decrypt it.
As you can see from this example, even if an attacker was eavesdropping and saw the public key being transmitted from RouterA to RouterB or vice versa, it would not do him any goodhe would need the private keys to decrypt data, and these are never shared by RouterA or RouterB.
Asymmetric Keying and Authentication
Besides being used for encryption, asymmetric keying also can help perform authentication functions. Figure 2-1 illustrates the use of asymmetric keying for authentication, where RouterA needs to authenticate to RouterB.
Figure 2-1. Asymmetric Keys and Authentication
As you can see in the figure, the following happens:
1. |
RouterA generates a public/private key combination.
|
2. |
RouterA shares its public key with RouterB.
|
3. |
RouterA takes identity information about itself, like its name, and encrypts it with its private key.
|
4. |
RouterA sends both the identity information and the encrypted identity information to RouterB.
|
5. |
RouterB decrypts the encrypted identity information and compares this with the clear-text identity information that RouterA sent.
|
6. |
If RouterB's comparison between the clear-text and decrypted identity information matches, then RouterB can be assured that RouterA did the encryption.
|
In the example in Figure 2-1, the private key, as in encryption, is never shared (kept private). The public key is shared and used to verify the encrypted identity information, commonly called a digital signature, created with the related private key.
One concern with this method of authentication is a man-in-the-middle attack, where someone other than RouterA generates the public/private keys and pretends to be RouterA. This can be overcome by pre-sharing the public key of RouterA, out-of-band, with RouterB. A more scalable approach will be discussed in the "Digital Certificates" section later in this chapter.
Advantages and Disadvantages of Asymmetric Keying
Asymmetric has many advantages over symmetric keying. First, through the use of large prime numbers, the protection process is more secure than with symmetric keys. A prime number is a positive integer not divisible without a remainder by any positive integer excluding itself and one. Two large prime numbers, multiplied together, are used, with an additional input, to generate the public and private keys.
No known method as of today can factor the correct number to break the encryption in a reasonable time, unlike with symmetric keying. For example, if I gave you two very large numbers, like 34,555 and 88,333, and asked you to multiply these numbers together, you could easily figure out the answer: 3,052,346,815. However, if I gave you 3,052,346,815 and asked you to figure out the two numbers that were originally used to come up with this value, you would probably spend the rest of your life trying to find the answer, and would probably be unsuccessful. This is the beauty of asymmetric keying, which is why, first, most asymmetric keying algorithms use this computation process. Second, an attacker needs to know both the private and public keys to compromise security, and the private key is never shared with any other device.
You would think that given these advantages, most algorithms would use asymmetric keying for security functions. But asymmetric keying is much slower than symmetric keying when performing its security functionin the neighborhood of 1,500 times slower! Therefore, symmetric keys are preferred when encrypting data, since latency and processing is of concern, but asymmetric keys are preferred when performing authentication, where establishing a device's identity is of importance, or for sharing keys, like symmetric keys, across an unprotected network.
Asymmetric Keying Examples
Here are some examples of standards/algorithms that use asymmetric keys:
- RSA public keying This is used for authentication functions to produce digital signatures and to perform encryption. RSA is short for Rivest, Shamir, and Adleman (Ronald Rivest, Adi Shamir, and Len Adleman), who were professors at the Massachusetts Institute of Technology who developed the process. RSA keying is commonly used with digital signatures found on certificates. It supports key lengths of 512, 768, and 1,024 bits, and larger.
- Digital Signature Algorithm (DSA) This is similar to RSA in that it is used to generate signatures for authentication functions, such as certificates; it is typically not used for encryption functions.
- Diffie-Hellman (DH) This is used by the Internet Key Exchange (IKE) protocol in IPsec to exchange keying information and keys securely between IPsec devices. DH is discussed in more depth toward the end of this chapter in the "Diffie-Hellman" section.
- KEA (Key Exchange Algorithm) This is an enhanced version of the DH implementation.