# CISSP cryptography training: Components, protocols and authentication

## Spotlight article: Shon Harris outlines the main topics in the CISSP domain on cryptography -- background information, cryptography components, digital authentication, protocols and more.

Cryptography is undoubtedly one of the most complex and daunting topics in information security. So let's start with the basics: What is cryptography?

Cryptography is a method of storing and transmitting data in a particular form so that only those for whom it is intended can read and process it. It is considered the science of protecting information as it encodes data into an unreadable format, usually through the use of complex mathematical algorithms. cryptography can effectively protect sensitive information from third parties as it is either stored on media or transmitted through untrusted network communication paths.

Almost all information security is based on some type of cryptography, but the sheer complexity of cryptography often works against security practitioners. Because only a small portion of today's security experts really understand cryptography, and the lack of knowledge in this area leads to operating systems, software applications, protocols and network-based products with poorly implemented cryptographic functionality. These poor implementations are what attackers often seek to exploit.

In this spotlight article for the Cryptography domain of the Certified Information Systems Security Professional (CISSP) exam, I will not only discuss why cryptography is usually considered to be the most difficult domain within the Common Body of Knowledge (CBK), but also one of the most critical when it comes to real-world application. Read how cryptography and cryptography training have become critical components of information security as a whole.

## Cryptography background

In the past, messengers were used as the transmission mechanism, and encryption helped protect the message in case the messenger was captured. Today, the transmission mechanism has changed from human beings to data packets carrying 0s and 1s through network cables or open airwaves. The messages are still encrypted in case an intruder captures the transmission mechanisms as they travel along their paths.

One of the main goals of cryptography is to hide sensitive information from unauthorized individuals. However, with enough time, resources and motivation, attackers will eventually break cryptosystems and gain access to critical and sensitive data. A more realistic goal of cryptography is to make these compromise attempts too work-intensive or time-consuming to be worthwhile to the attacker.

Cryptography as a science has evolved exponentially over the last 30 years, producing new and more powerful methods that are well beyond the capability of humans unaided by computer technology. While early cipher methods based on substitution and transposition still form the basis of plain text-to-ciphertext translation, the algorithms used in transformation have become increasingly complex because of computer processing. In the video for this lesson, I will discuss the evolution of cryptography from its earliest known application and provide students with the foundation needed to understand the complex approaches in use today.

A cryptographic system is measured by the strength of its underlying algorithm and the complexity of the cryptographic functions involved with encryption and decryption processes. However, the most important way to comprehend and measure the strength of a cryptosystem is through its implementation. Despite today's amazingly strong algorithms, compromises are still taking place. This is mainly because when developers integrate algorithms into their code, they don't implement all of the necessary pieces properly, leaving vulnerabilities.

We have seen many examples of this, such as when SSL was first released (it could be broken in two minutes) and with the Wired Equivalent Privacy or WEP protocol in WLAN communication -- which can be broken in about 30 minutes depending upon the amount of traffic one seeks to decrypt. Most recently, the Heartbleed vulnerability uncovered in OpenSSL illustrates how poor implementation can bypass all of our strong algorithms and leave a large percentage of e-commerce websites vulnerable. Remember that proper cryptography isn't just using a strong algorithm; it's about understanding *all* of the pieces and parts that are involved in the process.

## Cryptography components

The algorithm -- or the set of mathematical formulas -- dictate how enciphering and deciphering take place. Many algorithms are publicly known and well understood and therefore aren't the secret part of the encryption process. In fact, it's often said that secrecy of the algorithm is not something that you should base your security on.

The secret component of using a well-known encryption algorithm is the key. The key is a value made up of a sequence of random bits. Is it just any random number of bits crammed together? Not really. An algorithm contains a keyspace, which is a range of values that construct a key. The key is made up of random values within this keyspace range. The larger the keyspace, the more available values can be used to represent different keys. The more random the keys, the harder it is for attackers to crack them. For example, if an algorithm allows a key length of 2 bits, the keyspace for that algorithm would be four; this indicates the total number of different keys that would be possible. This is not a large keyspace, and it certainly would not take an attacker very long to find the correct key. Today's cryptographic keys are commonly 256-, 1,024- or even 2,048-bits long, depending on the algorithm type.

To calculate the size of the keyspace for each of these key lengths, take the key length and square it. For example, the keyspace of an algorithm that uses a key size of 1,024 is (1024)^{2} -- or 1,048,576. This is a huge amount of bits to choose from when an algorithm has to create a new key.

While many people understand the concept of an algorithm and know that a key is involved, they don't necessarily understand the direct relationship between the two. An algorithm is a static set of mathematical formulas. Anything that is static in security must have a way to incorporate a lot of randomness to provide the necessary level of complexity so that it cannot be easily reverse-engineered. While this is a simplistic explanation, it is helpful to conceptually understand the relationship between an algorithm and its associated key.

Let's say that an algorithm is made up of the following equations:

4 + x + y = 16 = z

z + 56 + b + 3 = T

Since an algorithm is static, it will use these equations over and over again. Note: Attackers could figure out the equations and access the encrypted sensitive data if this is all there was to encryption.

This is where keys come in. Keys are random numbers that populate some of the empty variables in the equations. The data that needs to be encrypted populates the remaining empty variables. In our example, *x* is populated with the first three bits of the cryptographic key and *y* is populated with the first three bits of the plaintext that needs to be encrypted. In the second equation, the result of the first equation is carried over, and *b* is populated with the next three bits of the key. The resulting *T* value is the ciphertext that is sent to the receiver.

4 + x + y = 16 = z

z + 56 + b + 3 = T

When a new message is encrypted using the same algorithm, a new key value is generated, and each empty variable will be populated with values from the new key and the plaintext bits. (Again, this is a conceptual example, so veteran cryptographers would no doubt note this explanation lacks the level of detail required for cryptography to succeed in practice.)

The other role of the key is to scramble the sequence of the equations used during the encryption process. For example, if an algorithm is made up of 15 equations, using them in a step-wise sequence would not provide enough randomness; an attacker could figure out that "equation 2" always follows "equation 1","equation 3" always follows "equation 2", and so forth. The key must also be used as a set of instructions for the algorithm to use to make its static and predictable equations more complex. For example, key 1 would tell the algorithm to use equations 13, 4, 9, 10, etc. Key 2 would tell the algorithm to use equations 3, 12, 5, 7, etc.

An algorithm is a complex but static set of mathematical equations and logic functions. It is the key that provides the necessary randomness to the encryption process. The mix of complex math and random key values results in hard-to-break cryptographic functionality.

## Symmetric vs. asymmetric key algorithms

Cryptographic algorithms are broken up into two main categories: symmetric and asymmetric key algorithms. When a cryptosystem uses symmetric cryptography, both parties use the same key value for encryption and decryption processes. This approach provides dual functionality. Symmetric keys are also called secret keys, because this type of encryption relies on each user to keep the key a secret and properly protected. If an intruder were to get this key, he or she could decrypt any intercepted message encrypted with this key.

Some of the symmetric algorithms covered in the CISSP exam include Data Encryption Standard (DES), Triple DES (3DES), Blowfish, International Data Encryption Algorithm (IDEA), RC4, RC5, RC6 and Advanced Encryption Standard (AES).

Symmetric cryptography has several issues that are solved by using asymmetric and symmetric algorithms together. In symmetric key cryptography, a single secret key is used between entities, whereas in public key systems, each entity has different or asymmetric keys that are mathematically related. If a message is encrypted through the use of one key, the other key is required in order to decrypt the message. In a public key system, the pair of keys is made up of one public key and one private key. The public key can be known to everyone and the private key must only be known and used by the owner.

In a hybrid approach, both symmetric and asymmetric technologies are used in a complementary manner, each performing a different function. A symmetric algorithm creates keys that are used for encrypting large amounts of data, and an asymmetric algorithm creates keys that are used for encrypting smaller amounts of data. In most implementations, a symmetric key is used to encrypt a message and then an asymmetric key is used to encrypt the symmetric key.

Some of the asymmetric algorithms covered in the CISSP exam include the RSA algorithm, elliptic curve cryptography (ECC), Diffie-Hellman and El Gamal.

## Cryptography methods and uses

A public key infrastructure (PKI) consists of programs, software, procedures, communication protocols, security policies and public key cryptographic mechanisms working in a comprehensive manner to enable a wide range of dispersed people to communicate in a secure and predictable fashion. In other words, a PKI establishes a level of trust within an environment.

PKI is an ISO authentication framework that uses public key cryptography and the X.509 digital certificate standard. The PKI framework was developed to enable authentication and data encryption across any networked environment, and between individuals who may have never communicated before. Particular protocols and algorithms aren't specified, which is why PKI is called a framework rather than a specific technology. The CISSP exam covers the roles and responsibilities of many of the components of a PKI: registration authority, certificate authority, certificate repository, certification revocation list and more.

The true benefit and beauty of a PKI is the trust models it provides. For example, if I needed to send you an encrypted message yet have never communicated with you before, and if we were not set up to communicate through a PKI structure, I would have to figure out how to get you a symmetric key securely so you can decrypt the message I send. This is a laborious, time-consuming and error-prone process that would involve manually installing a key on your system. I would also have to figure out a way to authenticate my identity so you know that I am the person I am representing myself to be. If you do not know me, you do not know to trust me -- that is how security works. But if we both trusted the same outside entity (a certificate authority), then this trusted entity can vouch for my identity to you, and through the use of asymmetric cryptography, I can send you an encryption key through a protocol in an automated fashion.

PKI is critical to understand because all e-commerce and Internet-based secure communications are ultimately based on PKI. The reason that the Heartbleed vulnerability was so detrimental to any website that used OpenSSL was because it bypassed all of the security provided within a PKI structure. If organizations completely depend on PKI for e-commerce transactions and the No. 1 protocol used for these communications (SSL) has a vulnerability to bypass PKI security, there is no safety net.

While many people have a cursory understanding of PKI and its components, the security industry is in great need of infosec professionals who have a much deeper understanding of cryptographic technology. The fact that cryptography is a whole domain of the CISSP cryptography training program's CBK illustrates its importance, and the fact that it is one of the largest domains further illustrates the complexity of cryptography as a whole.

The CISSP exam has evolved from just asking test-takers the key size of the DES algorithm to requiring them to prove that their understanding of how the pieces of cryptography work together to provide specific security functions. In the real world, it doesn't matter if you know that DES uses a 64-bit key if you don't know how symmetric cryptography works or the importance of a large, random key value. As a security professional, it is your job to not only ensure that the right cryptographic techniques and technologies are being used in the right situations, but also to be able to identify flaws in cryptographic implementations.

For example, the OpenSSL Heartbleed vulnerability existed for years, and even though thousands of websites depended solely on this protocol for secure transmissions, it took years for anyone to identify it. Heartbleed was a well-publicized vulnerability, but, in truth, these same types of flaws exist in many of our software products today.

Cryptography is hard, and in many situations it is too much to ask of our software developers to know how to write programming code to make a piece of software do 1,000 different things on five different platforms, and at the same time implement cryptography successfully. Security professionals must be more involved with integrating cryptography into products that so many consumers and organizations depend upon, which means that the industry needs security professionals who are proficient in cryptography.

## Digital authentication

Since most communication that takes place today happens in the digital world, it is important to use strong authentication methods that cannot be easily spoofed. As discussed earlier, a PKI is the most-used framework for allowing digital authentication to take place. When digging into the weeds of cryptographic authentication, it becomes clear that there are other algorithm types that must also be understood.

Digital signatures are a combination of hashing algorithms and asymmetric algorithms. If I am sending you an email message and want to ensure that the message is not tampered with during transit and I also need to confirm you know the message really came from me, I will use a digital signature. This means my email client will take my message and pass it through a hashing algorithm. The result of this process is a message digest that is a set of bits (for example, it would be 128 bits if the hashing algorithm MD5 is used). My email client then takes my private key and encrypts this message digest value, which results in a digital signature. This digital signature and my message are then sent to your system. Your email client takes my public key and decrypts the digital signature and then runs my message through the same hashing algorithm, comparing the hash value I sent with the one your system generated. If the hash values match, your system knows the message has not been modified during transmission. And if your system can decrypt the digital signature with my public key, then your system knows that the message came from me.

As a security professional, you need to not only know how these things work, but also how they can be compromised; you can never really understand how something can be broken if you don't fully understand that thing in the first place. For example, if I send you a self-signed digital certificate in this process, there is no real authentication taking place. The Internet is full of websites that hand out self-signed certificates, which are basically worthless when it comes to secure authentication. However, without people who have the necessary understanding and awareness to identify these vulnerabilities, systems are at risk to attackers sending certificates and spoofing their identities. If your browser is not properly configured, you may think that you are communicating with your mother, but in reality it is an attacker in North Korea. In a more serious scenario, sensitive financial information could be going to malicious individuals who will in turn cause great harm, and no one would be alerted of this breach.

## Cryptography protocols

Since all digital communication takes place over some type of protocol, it is important to understand how the different protocols use cryptography to protect sensitive data as it traverses untrusted environments.

A network protocol stack is complex and made up of many different protocols working in tandem. Cryptographic security can be implemented at many different layers of a network stack (application, session, network, data link), and each exists for a specific purpose. It is critical to know which network stack level provides a specific type of cryptographic protection, and what type of protection is actually being provided.

For example, if SSL is being used, the packet's headers and trailers are not being protected; this means an attacker could modify these data types and carry out attacks that could not take place if IPsec was being used. In another example, if encryption were happening at the data link layer (link encryptor), this connection would have to be a point-to-point connection because intermediate devices (e.g., routers or switches) would not be able to decrypt and read the necessary header data.

## Conclusion

Technology is complex, and being able to secure technology properly is even more complex. All too often, organizations make it too easy for attackers to accomplish their goals. The security industry has incredibly strong algorithms and cryptographic technologies, but because most people do not understand cryptography to the necessary depth, these protections are not being properly implemented and used.

In the multimedia videos for this domain of the CISSP training, I cover many of these items to help you prepare for the exam and your security career. Topics including SSL -- which protects a communication channel at the session and transport layers of a network stack through the use of symmetric and asymmetric cryptography -- will be discussed, as well as hashing algorithms, digital certificates, digital signatures and PKI.

*CISSP is a registered certification mark of the International Information Systems Security Certification Consortium Inc., also known as (ISC)2.*