### CISSP Domain 3 – CRYPTOGRAPHY INTRODUCTION

Cryptography is the art of secure communication whereby of hiding information that is in plain text (human readable) is converted into ciphertext (an unreadable form) for the purposes, or services of confidentiality, Integrity, Authenticity, Access control and Non-repudiation. Expanding on this, Cryptography can provide confidentiality (secrets remain secret) and integrity (data is not altered in an unauthorized manner). Cryptography can also provide authentication (proving an identity claim). Additionally, cryptography can provide nonrepudiation, which is an assurance that a specific user performed a specific transaction and that the transaction did not change.

## CISSP Domain 3 – What is Data Encryption?

Data encryption is a method of protecting data by encoding it in such a way that it can only be decrypted or accessed by an individual who holds the correct encryption key. When a person or entity accesses encrypted data without permission, it appears scrambled or unreadable.

The cryptographic life cycle involves the following steps:

**Plain-Text**: At this step, it means a text that has no encryption and is in its original state and can be easily read. (example: CISSP)**Encryption**: A process that uses cryptographic algorithms and techniques to converts a Plain-text into a ciphertext so that text cannot be understood by humans or machines.**Cipher-text**: information that is not in a human or machine-readable format. The ciphertext is the encrypted version of the plain text. (example SDE15E7Ja)**Decryption**: Converting process a ciphertext to a plain-text at the destination.**Plain-Text**: At this step, it is a text that has been decrypted and can be easily read again. (example: CISSP)

First of all, you need to know a few concepts.

**Block Ciphe**rs – Block ciphers operate on a single fixed block of plaintext to produce the corresponding ciphertext. Using a given key in a block cipher, the same plaintext block always produces the same ciphertext block.

**Stream ciphers** − Stream ciphers are symmetric key algorithms that operate on a stream of data and use a secret key to encrypt and decrypt the data. Stream ciphers are generally faster and more efficient than block ciphers, but they are also generally considered to be less secure.

**Round** – It is a transformation (permutations and substitutions) that an encryption algorithm performs on a block of plaintext to convert (encrypt) it into ciphertext.

**Feistel ciphers** − Feistel ciphers are a type of block cipher that are based on a structure known as a Feistel network. They are widely used in symmetric key algorithms and are known for their efficiency and ease of implementation.

## CISSP Domain 3 – **Cryptographic Methods**

There are two primary types of modern encryption:

**Symmetric** – same key is used. The word “symmetry” means “the same” in mathematics. The key is established “out of band” which means it is established outside of the transmission medium that will be used for the encryption. Another issue is scalability due to the number of keys needed as the number of users increases. (a different key is required for each pair of communication parties)

**Asymmetric** – different keys are used, one to encrypt, and another to decrypt. Also can be called public key cryptography. The **public key** can be made available to anyone, as it should be. The **private key** should not be made available to anyone except the person it belongs to. Only two key pairs are needed per user, thus asymmetric cryptography is scalable and solves the key management issues associated with symmetric keys systems.

In this method, two keys are used:

**Private Key**: This key is only known by the owner itself.**Public key**: This key is issued by using Public Key Infrastructure (PKI) where a trusted Certification Authority (CA) certifies the ownership of key pairs.

Only the private key can decrypt the message; thus, an attacker possessing only the public key can’t decrypt the message. A secure message guarantees the confidentiality of the message.Everyone knows public key while one key is kept secret and is used to encrypt the data by the sender. Each sender uses its secret key (known as a private key) for encrypting its data before sending.The receiver uses the respective public key of the sender to decrypt the data.When two parties want to exchange an encrypted message by using asymmetric key cryptography, they follow these steps:

- The sender encrypts the plaintext message with the intended recipient’s public key.
- This produces a ciphertext message that can then be transmitted to the intended recipient.
- The recipient then decrypts the message with his private key, known only to him.

## CISSP Domain 3 – **Public Key Infrastructure (PKI)**

A PKI is an arrangement whereby a central authority stores encryption keys or certificates associated with users and systems. PKI is a key element in cryptography.

The four basic components of a PKI are:

**Certificate Authority (CA)**: It comprises hardware, software, and the personnel administering the PKI. The CA issues certificates, maintains and publishes status information and Certificate revocation Lists (CRLs), and maintains archives.**Registration Authority (RA)**: It’s responsible for verifying certificate contents for the CA. This component comprises hardware, software, and the personnel administering the PKI.**Repository**: It is a system that accepts certificates and CRLs from a CA and distributes them to authorized parties.**Archive**: An archive offers long-term storage of archived information from the CA.

## CISSP Domain 3 – **Types of Symmetric Key Algorithm**

Types of symmetric encryption algorithms:

**Data Encryption Standard (DES)**: Developed in the early 1970s and is now considered a legacy encryption algorithm. DES is a block cypher that operates on 64-bit blocks, and uses 56-bit Key size that is too small to protect data consisting. This algorithm is consisting of 16 rounds processing the data with the 16 intermediary round keys of 48-bit generated from 56-bit cipher key by a Round Key Generator. Due to its short key length, the encryption standard was not very secure.**Triple DES (3DES)**: This standard extended the life of the DES algorithm. In Triple DES implementations, a message is encrypted by using one key, encrypted by using the second key and then again encrypted by using either the first key or a third key.**RC2**: Ron Rivest developed the RC2 algorithm in the late 1980s as a replacement for DES. RC2 is a block-mode cipher that encrypts 64-bit blocks of data by using a variable-length key of 8 to 128 bits in 8-bit increments. Because a large part of an encryption algorithm’s strength lies in the length of its keys, researchers now consider RC2 to be too easily compromised**RC4**: RC4 is a stream cipher encryption algorithm that is commonly used in wireless networks and other applications that require fast encryption and decryption. It supports key sizes of up to 256 bits.**RC5**: Similar to RC2, but includes a variable-length key (0 to 2,048 bits), variable block size (32, 64, or 128 bits), and a variable number of processing rounds (0 to 255).**RC6**: Derived from RC5 and a finalist in the AES selection process. It uses a 128-bit block size and variable-length keys of 128, 192, or 256 bits.**International Data Encryption Algorithm (IDEA)**: This algorithm is a block cipher that operates on 64- bit plaintext blocks by using a 128-bit key. IDEA performs eight rounds on 16-bit subblocks and can operate in four distinct modes similar to DES. Of course, the IDEA isn’t not widely used today.**Advanced Encryption Standard (AES**): also known as Rijndael, supersedes DES. AES is an encryption standard used by the US government to encrypt classified information. Advanced Encryption Standard (AES) is a 128-bit block cipher that employs 128, 192, or 256-bit keys. AES is official successor to DES. AES is well-known for its great security and efficiency, making it a popular choice for a wide range of applications.**BLOWFISH**: Blowfish is a symmetric key encryption algorithm designed to replace DES. This algorithm operates on 64-bit blocks, employs 16 rounds, and uses variable key lengths of up to 448 bits. To date, there are no known successful cryptanalytic attacks against this algorithm. Blowfish is commonly found on e-commerce platforms, securing payments, and in password management tools.**TWOFISH**: Twofish is Blowfish’s successor and is one of the fastest fixed-block algorithms currently available. This algorithm is a symmetric block cipher that operates on 128-bit blocks employing 16 rounds with variable key lengths up to 256 bits. To date, there are no known successful cryptanalytic attacks against this algorithm.

**All modes of the DES algorithm**

- Electronic Codebook (ECB). Each 64-bit block is encrypted and decrypted independently
- Cipher Block Chaining (CBC). Each 64-bit block depends on the previous one and uses an Initialization Vector (IV)
- Cipher Feedback (CFB). The preceding ciphertext becomes the input for the encryption algorithm, producing pseudorandom output, which in turn is XORed with plaintext, building the next ciphertext unit
- Output Feedback (OFB). Much like CFB, except that the encryption algorithm input is the output from the preceding DES
- Counter (CTR). Each plaintext block is XORed with an encrypted counter. The counter is then incremented for each subsequent block

## CISSP Domain 3 – **Types of Asymmetric Key Algorithm**

**Rivest, Shamir, and Adleman (RSA)**: Named after its inventors, this algorithm uses a variable size encryption block as well as a variable size key. The algorithm uses a product of two large prime numbers to derive the key pairs. The security of this algorithm lies in the problem of factoring very large integers, and in the RSA problem, because fully decrypting a ciphertext with RSA is currently not possible, although partial decryption is possible.**Diffie-Hellman**: Whitfield Diffie and Martin Hellman suggested it in 1976 as a mechanism for two parties to agree on a shared secret key via an unsecure channel without explicitly exchanging the key. This method is used primarily for private-key exchange over an insecure medium. This method is vulnerable to Man-in-the-Middle Attacks.**ElGamel**: ElGamal is an asymmetric key encryption algorithm that generates public and private keys via the discrete logarithm problem. It is similar to Diffie-Hellman but extends the functionality of Diffie-Hellman by including encryption and digital signatures.**Elliptic Curve Cryptography (ECC)**: This is an algorithm that generates keys from elliptical curves. It is based on the difficulty of determining the discrete logarithm of a random elliptic curve. A 160-bit EC key is equivalent to a 1,024-bit RSA key. EC is significantly faster and more efficient than other asymmetric algorithms and many symmetric algorithms.**Digital Signature Algorithm (DSA)**: The DSA algorithm was developed in 1991 by the National Intitute of Technology (NIST). DSA is a popular asymmetric key encryption technique for digital signatures and is frequently used in applications like as electronic voting systems and online contracts that require secure authentication and non-repudiation. Key sizes of up to 1024 bits are supported.

## CISSP Domain 3 – **Hashing** Functions

Hashing and cryptography have a very close relationship. When we look at Cryptography it focuses on providing services to cover all 3 pillars of the CIA triad. Hashing on the other hand focuses primarily to provide integrity. Hash functions are used to help authenticate the source and integrity of files and to generate digital signatures.

A hash function is defined as a one-way operation that accepts an input message (of any length) and generates a fixed-length output. The output that gets generated from the original message is typically referred to as a message digest, or hash.

**Hashing Algorithms Family**

- Message Digest (MD): It is a family of one-way hashing algorithms that includes MD (obsolete), MD2, MD3 (not widely used), MD4, MD5, and MD6.
- Secure Hash Algorithm (SHA): This family is more secure, and widely used hashing algorithm. There are several versions of this algorithm.

## CISSP Domain 3 – **Common Hashing Algorithms**

**MD5**: The MD5 hashing algorithm (RFC 1321) was designed in 1992 by Ron Rivest as an improved version of MD4. It is one of the most popular hashing algorithms and was one of the first to gain widespread approval. MD5 produces a 128-bit digest. Messages are processed in 512-bit blocks, using four rounds of transformation. The resulting hash is typically represented as a 32-digit hexadecimal number. MD5 is susceptible to collision.**MD6**: It uses very large input message blocks (up to 512 bytes) and produces variable-length digests (up to 512 bits).**SHA1**: SHA stands for secure hashing algorithm. Published in 1995, it takes a variable size input (message) and produces a fixed-size output (160-bit message digest, versus MD5’s 128-bit message digest). SHA-1 processes messages in 512-bit blocks and adds padding to a message length, if necessary, to produce a total message length that’s a multiple of 512. This algorithm is not stable, so it is recommended not to use it.**SHA2**: Published in 2001, it consists of four hash functions — SHA-224, SHA-256, SHA-384, and SHA-512 — that have digest lengths of 224, 256, 384, and 512 bits, respectively. SHA-2 processes messages in 512-bit blocks for the 224, 256, and 384 variants, and 1,024-bit blocks for SHA-512.**SHA3**: SHA-3: Published in 2015, SHA-3 includes SHA3-224, SHA3-256, SHA3-384, and SHA3-512, which produce digests of 224, 256, 384, and 512 bits, respectively. SHAKE128 and SHAKE256 are also variants of SHA3.*LANMAN*: Microsoft LANMAN is the Microsoft LAN Manager hashing algorithm. LANMAN was used by legacy Windows systems to store passwords. LANMAN used DES algorithms to create the hash. The problem is that LANMAN’s implementation of the DES algorithm isn’t very secure, and therefore, LANMAN is susceptible to brute force attacks.

## CISSP Domain 3 – **Cryptanalytic Attacks**

**Cryptanalysis** is the study of the cryptographic algorithms and the breaking of those secret codes. Cryptanalytic attacks exploit flaws in your system, deciphering its cryptography. Here are some examples of Cryptanalytic attacks:

**Know-Plaintext Analysis (KPA)**: In this type of attack, the attacker has some access to the plaintext-ciphertext pairs. Next, all the attacker has to do is map the pairs to find the encryption key. This attack is easy to use as the attacker has a wealth of knowledge at their disposal.**Ciphertext-only attacks**: This type of attack is where the would-be attacker only has access to at least one encrypted message but does not know the plaintext data, any cryptographic key data used, or the encryption algorithm being employed.**Chosen-cypher text attack**: In this sort of attack, the attacker only has some ciphertext and attempts to decrypt the encryption key and plaintext using only the ciphertext.**Chosen-plaintext attack:**This type of attack is much like the KPA method. This attack is there the attacker selects random plaintexts, obtains the ciphertexts, and attempts to decrypt the message.**Adaptive-chosen-plain text attack**: In this attack, cryptanalyst can choose the samples of plaintext based on the results of previous encryptions in a dynamic passion.**Adaptive-chosen-cypher text attack**: This is similar to the chosen ciphertext, but the samples of ciphertext are dynamically selected by the cryptanalyst.**Man-in-the-Middle Attack**: This attack is where an attacker intercepts messages transmitted over a secure channel between two communicators, obtaining the data and potentially modifying the original message.**Dictionary Attacks**: In this case, the attacker runs either plaintext or keys against a word dictionary. This technique is often used when trying to crack some encrypted passwords.**Brute Force Attack**: In this case, the attacker uses algorithms to predict the possible logical sets of plaintexts. The guessed plain text is then ciphered and compared against the initial cipher. While brute-force attacks may take a smaller amount of time for smaller keyspaces, it will take an immeasurable amount of time for larger keyspaces. Hence it is impractical to try brute-force attacks modern encryption systems.

Other mentionable attacks

- Fault injection attack — compromise the integrity of a cryptographic device by causing some type of external fault, such as the application of high-voltage electricity. This attack require on-site physcial access to the premise.
- Side-channel attack — uses information gathered about a system’s use of resources, timing, or other characteristics to contribute to breaking the security of encryption.
- Timing attack — measure the length of time consumed by encryption operations.
- Replay attack
- Pass the hash
**Algebraic attack**– relies on math structure of the block cipher.**Rainbow table**– a table of hash outputs, commonly used against password files.**Frequency analysis**– examining the frequency of certain pieces of ciphertext in order to decipher the frequency of English letters or words that are common (e.g. “the”).**Birthday attack**– there is a 50% chance of any two people having the same birthday in a room of 23 individuals. Without getting into the math, the intent of a birthday attack is to allow the discovery of collision capabilities in order to change message contents while keeping the same digest, or to incite doubt on the integrity of the original message.**Factoring attack**– tries to find the private key through solving the factoring of public keys (aimed at RSA specifically because it uses the product of large prime numbers to generate public/private keys).

**Digital Rights Management (DRM)**

DRM is about the protection of data, such as spreadsheets and email messages. The solutions provide a common set of foundation features:

- Restrict viewing of a document to a defined set of people
- Expire a document (rendering it unreadable after a specified date)
- Restrict editing of a document to a defined set of people
- Provide portable document protection such that the protection
- Restrict printing of a document to a defined set of people

## CISSP Domain 3 – Important Terms to remember

**Collision **– when a hash function creates the same output for two different inputs. For example if we ran a hash on “Hi” and a hash on “Yup” and both created “10110001110” as the output, we would have a collision. Collisions are bad for hashing algorithms for obvious reasons.

**Repudiation** – the denial of doing something, thus **non-repudiation** is the inability to deny something. For example, if someone at work sends an offensive email to another co-worker, cryptographic services can make it impossible for the offender to deny sending the offensive email. If the cryptographic services aren’t available, the offender might be able to repudiate, or deny sending the email and get away with it.

**Cryptanalysis** – refers to the attacks on cryptography. More on this later…

**Initialization vector** – this is the random number or value that is generated by the cryptosystem to add variance and security to the transmission.

**Encoding **– the act of changing something from human readable to machine readable. It includes encryption, in other words, encryption is a form of encoding but they are not the same thing.

**Decoding **– the act of changing something from machine readable to human readable. It includes decryption.

**Substitution** – changes one character for another

**Transposition** – reorders the characters without changing them

**Confusion** – changing the key during different rounds of encryption

**Diffusion** – switching around the location of plaintext within the ciphertext

**Avalanche** – the principle of having a small change in plaintext resulting in a large change in ciphertext

**Key clustering** – when different keys generate the same ciphertext from the same message

**Synchronous **– encryption requests are processed instantly

**Asynchronous** – encryption requests are processed in queues

**Work factor** – the amount of work, time, and effort it could take to break (i.e. to make useless) a cryptographic algorithm or cryptosystem

**Digital signature** – an encrypted hash on a message. The hash is encrypted with the private key of the signator, which means anyone can decrypt the hash, but that only the private key could have encrypted it. This is how authenticity of sender and integrity of message are achieved.

**Digital certificate** – a file containing public key, company information, and digital signature of the certificate authority.

**Certificate authority (CA)** – an authority in a public key infrastructure that issues, revokes, and manages digital certificates that validate public keys.

**Public Key Infrastructure (PKI) **– as the term indicates, PKI is a complete infrastructure of systems, software, protocols, and communications to publish keys, issue certificates, validate public keys (that the key is correct and that it is tied to a specific entity), and to provide all the services of cryptography (confidentiality, integrity, authenticity, non-repudiation, access control).

**Registration authority (RA)** – sometimes combined with CA, a server/entity that does registration of certificates on behalf of the CA.

**Key length **– when creating keys, the longer a key is the more combinations are possible (called **keyspace**). The key length however, is described in bits; both terms are simply numbers, but one is described in bits and the other is just a number. The keyspace is the number of possibilities for the key that exist, so the longer the key is (i.e. if it has more bits, or a higher bit length/key length), the better defense you’ll have because you’ll have an exponentially large number of key combinations that attackers would have to choose from.

**Kerckhoff’s principle** – cryptosystems can still be secure if everything about the algorithm is public, as long as the key remains secret.

**Transposition/permutation **– moving the contents of the message around.

**Monoalphabetic** – using one alphabet

**Polyalphabetic** – using many alphabets

**One-time pad** – unbreakable cipher, the key is the same length as the message, which is a running-key cipher, which uses modular mathematics that include numeric representations of characters in the English alphabet.

**Steganography **– hiding the data rather than changing it. It conceals the message within the message. Can be used for covert channels, hiding text within a webpage (white font on a white background), hiding a message in an image, audio, or video file, and null ciphers.

**Null cipher** – hiding the message in the plaintext message, such as a poem where the first letter of each line makes up the content of the hidden message:

**Electronic Code Book** (ECB)- a block cipher mode that does not use an IV which means it lacks randomness, making cryptanalysis easier. ECB is mainly useful for transmitting a key.

**Cipher block chaining** (CBC) – a block cipher that is stronger than ECB due to having an IV and chaining, which XOR’s the ciphertext of the prior block.

**Elliptical Curve Cryptography** – uses discrete logarithm and provides more security than RSA with a smaller key (RSA (uses factoring).

**Bulk encryption** is the same as link encryption from domain 2, which is also called “**point to point**”, so be sure to NOT confuse that with **end-to-end encryption**, which is different.

**Digital envelope **is basically using a public key to encrypt a symmetric key for secure transmission.

The asymmetric key cryptography (public key cryptosystems) can provide digital signature capability when used in conjunction with a message digest (also known as hash values or fingerprints)

**Collision** occurs when a hash function produces the same value for two different methods.

**Quantum Cryptography**

An area of advanced theoretical research in computer science and physics that could usher in a new era of cryptography.

**X.509** governs digital certificates and the public key infrastructure (PKI). It defines the appropriate content for a digital certificate and the processes used by certificate authorities to generate and revoke certificates.

**Digital Signature**

Digital signature technology is supported by Asymmetric Key Algorithm. it enforces nonrepudiation and provides integrity and authentication. Note that the digital signature process does not provide confidentiality.

**The Digital Signature Standard under FIPS 186–4** allows federal government use of the Digital Signature Algorithm, RSA, or the Elliptic Curve DSA in conjunction with the SHA-1 hashing function to produce secure digital signatures.

The **PFX **format is most closely associated with Windows systems that store certificates in binary format.

The **P7B **format is used for Windows systems storing files in text format. The **PEM **format is another text format.