Cryptographic Elements in Windows Server 2003
In 9th grade science class, my good buddy Mark Roff and I would exchange secret notes. Our code used a system of numerical letter displacements based on pages from the Bantam paperback edition of Lord of the Rings. We included the page numbers in the notes spelled out in High Elvish runes with the certain knowledge that we were the only two kids in the school capable of understanding them. We would fold the notes in a certain way so that we knew they came from each other and that no one else had opened them.
Needless to say, a seasoned cryptographer would not have puzzled long over our notes. (To be fair, Mark was capable of constructing a much more sophisticated system but he kept it simple for my benefit.) Despite their lack of sophistication, though, the notes contained all the elements of a modern PKI: an encryption algorithm, a unique cipher key, a way of exchanging the key in secrecy, and a way to validate the integrity of the process.
The cryptographic services in Windows Server 2003 use two general encryption methods:
A block cipher divides data into chunks, pads the last chunk if necessary, and then encrypts each chunk in its turn. The better ciphers use the output of one encrypted block as the basis for the key for encrypting the next block (cipher block chaining). Most encryption algorithms use block ciphers.
A streaming cipher uses a series of seemingly random numbers seeded with a cipher key to encrypt a stream of bits. The random number stream is actually a predetermined series of bits based on the cipher key seed, so the stream can be decrypted if the cipher is known. Streaming encryption is much faster than block encryption for bulk data transfers.
The default crypto providers in Windows Server 2003 support the following algorithms:
RC2 and RC5.
Ronald Rivest, one of the team of Rivest, Shamir, and Adleman that formed RSA Labs in the early 90s, developed these algorithms. They are block encryption algorithms with variable block and key sizes. This variability makes them difficult to break if the attacker does not know the original sizes when attempting to decrypt captured data.
RC4, also from RSA, is a streaming encryption algorithm that also uses variable key sizes to thwart attacks.
The now-outdated Data Encryption Standard (DES) was co-developed by IBM and the U.S. Government. It uses a block algorithm with a 64-bit block and a 40- or 56-bit key. Its chief advantage was speed and exportability. DES was broken quite a while ago and is no longer use by any respectable encryption product.
A modification of DES constructed by Rivest at RSA that sandwiches standard DES encryption between two XOR bit-wise replacement runs, all with different keys.
Triple-DES is not so much a modification of DES as it is a way of strengthening the final output by running data through the DES engine three times.
The newly promulgated Advanced Encryption Standard (AES) uses the Rijndael (pronounced Rhine-doll) algorithm. This algorithm was developed by Joan Daemen and Vincent Rijmen of Belgium. AES will eventually displace DESX and 3DES.
In general, the longer and more complex the cipher key, the less likely it is that someone can deduce the contents of an encrypted message. This is not necessarily the case, of course. You could have an extraordinarily long key and an extraordinarily simple cipher, but what would be the point?
There are two types of cipher keys:
In this kind of cipher, the same key is used to encrypt and decrypt data.
In this cipher, two keys are mathematically paired together. One is used for encryption, whereas the other is used for decryption.
Asymmetric keys are associated with slow algorithms that are generally unsuitable for encrypting large amounts of data. Bulk encryption algorithms tend to use symmetric keys, but this presents the challenge of exchanging the key in a secure manner. Most modern systems use a hybrid method with a short-lived symmetric key encrypted with asymmetric key technology. Protecting and validating the asymmetric keys is the job of a PKI.
Encryption only fulfills two of the goals we set out to achieve, those of confidentiality and integrity. To get authentication and non-repudiation, PKI uses another form of data manipulation, the hash. (A hash is also called a message digest.)
In contrast to encryption, where the original input can be recovered, hashing scrambles the input with no chance of ever recovering it. If you've seen the last scene of the movie Fargo, you have an idea of how hashing works.
In its barest form, a hashing algorithm accepts a variable length input and produces a fixed-length output that is highly sensitive to the input. A single bit changed in the input produces dozens of changes to the output. The greater the number of bits in the hash, the more secure the algorithm. It takes longer to create a bigger hash, though, so there is a tradeoff between performance and security.
Digital signatures use hashing technology to verify a sender's identity. For example, the RSA digital signature method hashes a message (or TCP datagram) and then encrypts the hash with the sender's private key. The recipient hashes the message (or datagram) using the same algorithm and then decrypts the sender's hash using the sender's public key and compares the results. If the hashes match, the sender has been verified.
The Digital Signature Security Standard, or DSS, uses a similar signing method but generates the key pair using Digital Signature Algorithm (DSA) rather than RSA. DSA is slower but uses the more secure SHA-1 hashing algorithm, making it less likely that an attacker could generate an identical hash with different inputs.
Hashing is not a true cryptographic process but it is possible to add a cipher key to a hash to produce a kind of cryptographic mulligan stew. This technique is called Hashed Message Authentication Code, or HMAC. It is described in RFC 2104, "HMAC: Keyed-Hashing for Message Authentication." HMAC is used for digital signatures in S/MIME, IP Security (IPSec), and Secure Sockets Layer (SSL). It is also used for obfuscating passwords in Kerberos and NT LanMan (NTLM) Challenge-Response authentication.
It is theoretically possible to derive a hash by trial and error to produce a collision—that is, by producing a hash that has identical output for the same or dissimilar input. For example, Windows uses hashes to obfuscate passwords. Let's say you have a clear-text password of £oan$hark. The system hashes this password using RSA MD4 to produce a fixed, 128-bit hash that it stores in Active Directory. A password-cracking program can attempt to determine the password (or a substitute for the password) by hashing combinations of letters and numbers using MD4 until it gets a result that matches the hash in Active Directory.
Windows Server 2003 supports six hashing mechanisms:
MD4 and MD5.
(MD stands for message digest.) These are RSA algorithms. MD4 is used to hash user passwords in NT and Windows 2000 while MD5 is used to support third-party CHAP (Challenge Handshake Authentication Protocol) authentication for dial-in clients. Both algorithms process inputs in 512-bit blocks and produce a single 128-bit output block. MD5 is computationally more expensive but far more secure.
(pronounced Shah One). The Secure Hash Algorithm (SHA) was promulgated by the National Institute of Standards and Technology (NIST) to compliment the Digital Signature Standard (DSS). SHA-1 is based on MD4. It processes input in 512-bit blocks but produces a 160-bit output rather than 128-bit. This makes SHA-1 more secure than MD4 or MD5, all other things being equal. Also, SHA-1 is not as vulnerable to cryptanalysis thanks to the type of algorithm used to do the data scrambling. It is also faster than MD4 or MD5.
SHS (Secure Hash Standard).
This includes three extensions to the SHA-1 standard with larger digest sizes: SHA-256, SHA-384, and SHA-512. There is no Registry key to select a different algorithm. The application developer must select it from the function library.