# Email Security with Digital Certificates (Part 2)

## Symmetric Key Algorithms

Symmetric key algorithms rely on a “shared secret” encryption key that is distributed to all members who participate in the communications. This key is used by all parties to both encrypt and decrypt messages, so the sender and the receiver both possess a copy of the shared key. The sender encrypts with the shared secret key and the receiver decrypts with it. When large-sized keys are used, symmetric encryption is very difficult to break. It is primarily employed to perform bulk encryption and provides only for confidentiality. Symmetric key cryptography can also be called secret key cryptography and private key cryptography.

Symmetric key cryptography has several weaknesses:

• Key distribution is a major problem. Parties must have a secure method of exchanging the secret key before establishing communications with a symmetric key protocol;
• Symmetric key cryptography does not implement nonrepudiation. Because any communicating party can encrypt and decrypt messages with the shared secret key, there is no way to prove where a given message originated from;
• The algorithm is not scalable. It is extremely difficult for large groups to communicate using symmetric key cryptography. Secure private communication between individuals in the group could be achieved only if each possible combination of users shared a private key;
• Keys must be regenerated often. Each time a participant leaves the group, all keys known by that participant must be discarded.

The major strength of symmetric key cryptography is the great speed at which it can operate. Symmetric key encryption is very fast, often 1,000 to 10,000 times faster than asymmetric algorithms.

## Asymmetric Key Algorithms

Asymmetric key algorithms, also known as public key algorithms, provide a solution to the weaknesses of symmetric key encryption. In these systems, each user has two keys: a public key, which is shared with all users, and a private key, which is kept secret and known only to the user. But here’s a twist: opposite and related keys must be used in tandem to encrypt and decrypt. In other words, if the public key encrypts a message, then only the corresponding private key can decrypt it, and vice versa.

Consider this example: if Linda wants to send a message to Nuno using public key cryptography, she creates the message and then encrypts it using Nuno’s public key. The only possible way to decrypt this ciphertext is to use Nuno’s private key, and the only user with access to that key is Nuno. Therefore, Linda can’t even decrypt the message herself after she encrypts it. If Nuno wants to send a reply to Linda, he simply encrypts the message using Linda’s public key, and then Linda reads the message by decrypting it with her private key.

Asymmetric key algorithms also provide support for digital signature technology. Basically, if Nuno wants to assure other users that a message with his name on it was actually sent by him, he first creates a message digest by using a hashing algorithm (more on this below). Nuno then encrypts that digest using his private key. Any user who wants to verify the signature simply decrypts the message digest using Nuno’s public key and then verifies that the decrypted message digest is accurate. Digital signatures are discussed in more detail in the next part of this article series.

The following is a list of the major strengths of asymmetric key cryptography:

• The addition of new users requires the generation of only one public-private key pair. This same key pair is used to communicate with all users of the asymmetric cryptosystem. This makes the algorithm extremely scalable;
• Users can be removed far more easily from asymmetric systems. Asymmetric cryptosystems provide a key revocation mechanism that allows a key to be cancelled, effectively removing a user from the system;
• Key regeneration is required only when a user’s private key is compromised. If a user leaves the community, the system administrator simply needs to invalidate that user’s keys. No other keys are compromised and therefore key regeneration is not required for any other user;
• Asymmetric key encryption can provide integrity, authentication and nonrepudiation. If a user does not share their private key with other individuals, a message signed by that user can be shown to be accurate and from a specific source and cannot be later repudiated;
• Key distribution is a simple process. Users who want to participate in the system simply make their public key available to anyone with whom they want to communicate. There is no method by which the private key can be derived from the public key;
• No pre-existing communication link needs to exist. Two individuals can begin communicating securely from the moment they start communicating. Asymmetric cryptography does not require a pre-existing relationship to provide a secure mechanism for data exchange. This is true in most cases but not when using Outlook to encrypt messages as we will later see.

The major weakness of public key cryptography is its slow speed of operation. For this reason, many applications that require the secure transmission of large amounts of data use public key cryptography to establish a connection and then exchange a symmetric secret key. The remainder of the session then uses symmetric cryptography.

The most famous public key cryptosystem is named after its creators. In 1977 (yes, almost 40 years ago!), Ronald Rivest, Adi Shamir, and Leonard Adleman proposed the RSA public key algorithm that remains a worldwide standard today. They patented their algorithm and formed a commercial venture known as RSA Security to develop mainstream implementations of their security technology.

The RSA algorithm depends on the computational difficulty inherent in factoring large prime numbers. Prime Factorization is the decomposition of a prime number into a product of smaller prime numbers (a prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself). Each user of the cryptosystem generates a pair of public and private keys using this algorithm.

## Hashing Algorithms

As just mentioned, public key cryptosystems can provide digital signature capability when used in conjunction with a message digest. Message digests are summaries of a message’s content (not unlike a file checksum) produced by a hashing algorithm (also known as hash function). It’s extremely difficult, if not impossible, to derive a message from an ideal hash function, and it’s very unlikely that two messages will produce the same hash value.

Hash functions have a very simple purpose: they take a potentially long message and generate a unique output value derived from the content of the message. This value is commonly referred to as the message digest. Message digests can be generated by the sender of a message and transmitted to the recipient along with the full message for two reasons. First, the recipient can use the same hash function to re-compute the message digest from the full message. They can then compare the computed message digest to the transmitted one to ensure that the message sent by the originator is the same one received by the recipient. If the message digests do not match, that means the message was somehow modified while in transit. Second, the message digest can be used to implement a digital signature algorithm.

In most cases, a message digest is 128 bits or larger. Usually, the longer the message digest, the more reliable its verification of integrity.

The following are some of the more common hashing algorithms in use today:

• Message Digest 2 (MD2);
• Message Digest 5 (MD5);
• Secure Hash Algorithm (SHA-0, SHA-1, and SHA-2). These are government standard hash functions developed by the National Institute of Standards and Technology (NIST) and are specified in an official government publication, the Secure Hash Standard (SHS), also known as Federal Information Processing Standard (FIPS) 180;
• Hashed Message Authentication Code (HMAC).

## Public Key Infrastructure

The major strength of public key encryption is its ability to facilitate communication between parties previously unknown to each other. This is made possible by the public key infrastructure (PKI) hierarchy of trust relationships. These trusts permit combining asymmetric cryptography with symmetric cryptography along with hashing and digital certificates, giving us hybrid cryptography.

Certificates

Digital certificates provide communicating parties with the assurance that the people they are communicating with truly are who they claim to be. Digital certificates are essentially endorsed copies of an individual’s public key. When users verify that a certificate was signed by a trusted certificate authority (CA), they know that the public key is legitimate. Digital certificates contain specific identifying information, and their construction is governed by the international standard X.509. Certificates that conform to X.509 contain the following data:

• Version of X.509 to which the certificate conforms;
• Serial number (from the certificate creator);
• Signature algorithm identifier (specifies the technique used by the certificate authority to digitally sign the contents of the certificate);
• Issuer name (identification of the certificate authority that issued the certificate);
• Validity period (specifies a starting date and time and an ending date and time during which the certificate is valid;
• Subject’s name (contains the distinguished name of the entity that owns the public key contained in the certificate);
• Subject’s public key (the meat of the certificate, the actual public key the certificate owner used to set up secure communications)

Certificate Authorities (CAs) are the glue that binds the public key infrastructure together. These neutral organizations offer notarization services for digital certificates. To obtain a digital certificate from a reputable CA, we must prove our identify to the satisfaction of the CA. Some of the major CAs include Symantec, Thawte, GeoTrust, GlobalSign, Comodo Limited, GoDaddy and DigiCert.

Nothing prevents an organization from simply setting up shop as a CA. However, the certificates issued by a CA are only as good as the trust placed in the CA that issued them. This is an important item to consider when receiving a digital certificate from a third party. If we don’t recognize and trust the name of the CA that issued the certificate, we shouldn’t place any trust in the certificate at all. PKI relies on a hierarchy of trust relationships. If we configure our browser to trust a CA, it will automatically trust all of the digital certificates issued by that CA. Browser developers preconfigure browsers to trust the major CAs to avoid placing this burden on users.

## Conclusion

In this second part of this article series, we looked at Symmetric vs Asymmetric Key Algorithms and what a Public Key Infrastructure is. Next we will have an in-depth look at digital signatures and S/MIME.