Public/Private Key Services
Theoretically, users could exchange cipher keys with each user by copying the keys to a disk and transporting the disk using a secure courier. A PKI is a kind of electronic courier service that operates over a highly insecure network.Public key technology got its start back in the late 1970's when a couple of guys, Whitfield Diffie and Martin Hellman, developed a way to exchange secret keys right out in the open, the cryptographic equivalent of passing your wallet to the beer guy at a basketball game without worrying that someone will reach in to take a fiver.Soon after the introduction of the Diffie-Hellman key exchange method, the trio of Ron Rivest, Adi Shamir, and Len Adleman (founders of RSA Labs) took the idea of mathematically related keys and developed a more general-purpose encryption service using key pairs. Anything encrypted with one key can only be decrypted with the other key in the pair.RSA identifies one of the keys as a public key. The public key can be freely distributed. You can spray paint it on the side of a building without fear of compromising your security system. (Here in Phoenix where I live, spray-painting buildings has very nearly replaced newspapers as the primary means of public communication.) The private key is another matter. The private key is heavily protected. PKI entities take another user's public key and use it to encrypt messages that can then only be read by the user with the private key.RSA developed secure methods for validating and distributing public keys using certificates . A certificate contains a public key along with information about the key issuer, the key owner, and how long the key is valid.RSA continues to be a major force in the development of PKI technology. Visit its web site at www.rsalabs.com.Following the release of RSA public/private key exchange technologies, a computer programmer named Phil Zimmerman combined RSA asymmetric keys with a symmetric bulk encryption scheme to produce Pretty Good Privacy (PGP), still one of the most widely used mail encryption applications around. Visit the PGP web site, www.pgp.com. (PGP is now owned by Network Associates, www.nai.com.)Network Associates has stopped all new development for their PGP tools and has stated that support will be dropped sometime in 2002. Phil Zimmerman is working to make NAI put the PGP code in the public domain. Refer to the OpenPGP web site at www.openpgp.org for developments in this area.From its grassroots beginnings, public key technology has evolved into a systematic method for producing, acquiring, distributing, cataloging, and protecting cryptographic elements. The clearinghouse for PKI information is the PKIX Working Group, chartered by the IETF. For information, visit www.ietf.org/html.charters/pkix-charterl.
Public Key Technologies in Windows Server 2003
Windows Server 2003 supports these public key exchange methods:
- Diffie-Hellman
- RSA
- Digital Signature Standard (DSS)
Diffie-Hellman
Diffie-Hellman (D-H) is the granddaddy of public key technologies. It is a way to share a secret key across an open network without actually passing the key or an encrypted form of the key. Windows Server 2003 uses D-H to support IP Security (IPSec), Secure Socket Layer (SSL), and Transport Layer Security (TLS).In a D-H transaction, a sender and receiver use very large prime numbers and primitive roots of those prime numbers in an engine that produces secret keys. D-H relies on special features of prime numbers and logarithms of prime numbers in modulo algebra. Modulo is a Bizarro world where numbers are congruent if their remainders are equal after having been completely factored by the same number. The common divisor is called a modulus , hence the name. For example, 17/3 yields 5 remainder 2, so 17 mod 3 is 2. Because 23 mod 3 is also 2 (23/3 calculates out to 7 remainder 2), then 23 and 17 are congruent modulo 3.In D-H, two entities independently generate a secret random number, Ax from one entity and Bx from the other entity. They each process their random numbers through the D-H engine to produce a public number, Pa and Pb . They exchange these public numbers and then run them through a second part of the D-H engine to produce a secret key. Here's where the magic of modulo algebra comes into play. The separate calculations performed at the two entities produce the same result.The end result of this D-H transaction is a shared secret key that the entities can use for encrypting messages between each other. An attacker cannot reverse-calculate the D-H secret key without knowing the original secret random number at one of the entities.
RSA
Most of this topic concerns the generation and use of RSA keys, so I won't spend time discussing them now. Unlike Diffie-Hellman, where a key only exists during a particular session, RSA generates persistent keys that can be used for encryption, digital signatures, and so forth. Windows Server 2003 uses RSA for Kerberos. Exchange 2000 uses RSA for S/MIME.
Digital Signature Standard
In 1991, the National Institute of Standards and Technology (NIST) published standard 186, the Digital Signature Standard , or DSS. This standard incorporated a different method for generating public/private key pairs than the method used by RSA. The new method is called the Digital Signature Algorithm , or DSA.NIST published DSA to address a perceived problem with the RSA method for producing digital signatures. (Only a cynic would think that avoiding the RSA license fees had anything to do with this decision.)DSA uses session keys based on the difficulty of deriving discrete logarithms, just as Diffie-Hellman and RSA. The difference lies in the way the keys are used to apply and verify a digital signature. Using RSA, signing a message happens quickly, whereas verifying the signature is relatively CPU intensive. Using DSA, signing a message is the intensive step and the verification is simple. Windows Server 2003 supports both DSA and RSA. It's up to the application designer to decide which to use.
Windows Server 2003 Cryptographic Services
Windows Server 2003 uses a set of function libraries and executables to perform cryptographic chores such as generating cipher keys and handling certificates. In Windows 9x and NT, this library is called the Crypto API . In Windows 2000 and Windows Server 2003, it is called the Data Protection API , or DPAPI. The function calls in these libraries are common among all modern Windows platforms, although the underlying executable files are different. This ensures that encrypted and digitally signed data can be freely exchanged between all Windows clients.Each discrete set of crypto functions is supported by a Cryptographic Service Provider , or CSP. Microsoft supplies a set of CSPs with Windows Server 2003 to provide core cryptographic services. Third parties add their own CPSs to support their hardware or independent cryptographic functions. Figure 18.1 shows the list of CSPs in the Registry under HKLM | Software | Microsoft | Cryptography | Defaults | Provider.
Figure 18.1. Registry showing location of keys for Cryptographic Service Providers (CSPs).

This list is actually more complex than necessary. Before export controls were lifted on cryptographic technology, it was necessary for Microsoft to divide CSPs into U.S.-only and exportable versions, typically using a Base and Enhanced moniker. Now that all cryptographic technology in Windows Server 2003 is exportable, there are now only two core CSPs and a few vendor add-ons:
- RSAenh .
This CSP supports industry-standard RSA cryptographic functions along with U.S. Government cryptographic standards. These functions include key generation, certificate requests, hashing, and encryption. This CSP also supports Schannel services for secure web transactions. - Dssenh .
This CSP supports the U.S. Government's Digital Signature Standard and the more prevalent Diffie-Hellman key exchange transactions. - Smart card providers.
Windows Server 2003 includes generic interfaces for collecting tokens from smart cards and a set of drivers for Gemplus, Infineon (a spinoff of Siemens Semiconductors), and Schlumberger smart card readers.
Outlook 2000 and Outlook XP install another CSP, Exchcsp.dll, to support FIPS-140 compliant S/MIME. This provider is documented in a white paper available at csrc.nist.gov/cryptval/140-1/140sp/140sp110.pdf.
Key Storage
Windows Server 2003 and XP store a user's crypto keys in the user's profile. Figure 18.2 shows the locations.
- The user's private keys are stored under Crypto\RSA. The keys are encrypted with a Session key derived from a Master key generated by the Data Protection API , or DPAPI.
- The Master key is stored under Protect\<userSID >. It is encrypted using a special structure called an HMAC, which stands for Hash-based Message Authentication Code . An HMAC is a hash that combines a block of data with a secret key. The HMAC for the Master key consists of a SHA-1 hash of the Master key itself using the user's password hash as the secret key. This HMAC permits the Master key to be encrypted with a cryptographically strong key that is still derivable from the user's password.
- The user's public keys are stored under System Certificates\My\Certificates. Copies of the public key certificates are stored in the Registry. If a user is a member of a Windows Server 2003 or Windows 2000 domain, a copy of the user's public key can also be stored in Active Directory.
Figure 18.2. PKCS key locations in a user profile.

If