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.
In network security, keys serve a multi-functional process. For example, keys are used for all of these three critical VPN functions:
There are two basic types of keying solutions:
The following sections will talk more about these two basic types of keying implementations.
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:
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.
Unlike symmetric keying, where the same key is used to create and verify the protection information, asymmetric keying uses two 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:
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:
RouterA generates a public/private key combination.
RouterA shares its public key with RouterB.
RouterA takes identity information about itself, like its name, and encrypts it with its private key.
RouterA sends both the identity information and the encrypted identity information to RouterB.
RouterB decrypts the encrypted identity information and compares this with the clear-text identity information that RouterA sent.
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:
Part I: VPNs
Overview of VPNs
PPTP and L2TP
Part II: Concentrators
Concentrator Product Information
Concentrator Remote Access Connections with IPsec
Concentrator Remote Access Connections with PPTP, L2TP, and WebVPN
Concentrator Site-to-Site Connections
Verifying and Troubleshooting Concentrator Connections
Part III: Clients
Cisco VPN Software Client
Windows Software Client
3002 Hardware Client
Part IV: IOS Routers
Router Product Information
Router ISAKMP/IKE Phase 1 Connectivity
Router Site-to-Site Connections
Router Remote Access Connections
Troubleshooting Router Connections
Part V: PIX Firewalls
PIX and ASA Product Information
PIX and ASA Site-to-Site Connections
PIX and ASA Remote Access Connections
Troubleshooting PIX and ASA Connections
Part VI: Case Study