Intro

Today's approaches to the cryptographic protection of information include symmetric and asymmetric encryption. In this lesson, I describe cryptographic entropy, how symmetric encryption achieves it, and the reason why it's not practical to crack AES. You can download the script for this video from the link above or at the end of the video.

Cryptographic Entropy

Before trying to understand encryption, we need to understand cryptographic entropy. Cryptographic entropy is the measure of the number and value of similarities between plain text and resulting ciphertext let's see how this works. This is a sample of a simple substitution cipher. I shifted the normal alphabet three positions to the left and substituted the plain text letters with letters in their normal alphabetic positions. For a more detailed look at how substitution ciphers work and pattern matching, please view the video above. Each language has its own patterns of usage. For example, our plain text contains a common letter "t" that is also commonly doubled. Further, the spaces between words allow a cryptanalyst to identify two-letter words. Common two-letter words in English are TO and AT. based on these known language patterns, it's easy to identify W in the ciphertext as likely being T. Once this is known, the shifted alphabet is easy to identify. This ciphertext has very low entropy. This is an example of a ciphertext with very high entropy. The ciphertext was created with AES cipher block chaining or CBC. We cover that in a later slide. Note that the cybertext has no pattern relationships with the plain text. The entropy is so high that cryptanalysts have not found a practical way to crack AES encryption other than guessing or stealing the key. At its most basic level, symmetric encryption uses a single shared key to both encrypt and decrypt data. There are two general approaches to symmetric encryption: use of stream ciphers or use of block ciphers A stream cipher is similar to a one-time pad.

Stream Ciphers

I described in detail how these work in a video above. This is a simple stream cipher example. Each bit in the data stream is XORed with each bit in the keystream to create the cipher stream as shown below. XOR is a boolean operation in which the output is 1 if all inputs are not the same. If the key is truly random, and is the same length as the plain text bitstream, and is only used once, the resulting cipher stream is unbreakable. However, this is not usually practical. In actual use, convenient key sizes are used, but the keys must be large enough to resist attacks. For example, 128-bit random keys might be generated for application across messages of any size. The key is reused as additional bits are needed to pair with plain text bits. This makes the key pseudo-random because of the key length and its repetitive use. It might be possible to crack the ciphertext. One way to strengthen the security of a stream cipher is to add a nonce to the key stream. The nonce is a truly random value. In many cases, the nonce contains a granular time stamp to ensure uniqueness. The key is secret but shared between the sender and receiver. The nonce is not secret, and it's sent with the message stream. Both the key and the nonce are needed for decryption. This allows reuse of the same key because of the uniqueness of the nonce. There are two types of stream ciphers: synchronous and self-synchronizing. Synchronous ciphers require perfect synchronization between sender and receiver. If a character in the stream is added, dropped, or changed, decryption will fail from the point at which a change was made. Self-synchronizing ciphers enable automatic re-synchronization. If a character changes, resync is possible after the receiver receives a certain number of characters. These are examples of stream ciphers. What we've looked at so far is the basic operation of stream ciphers, but they're not all made the same. For example, cha-cha, a very popular cipher, uses a key and nonce, but it can also rearrange letters. It also uses a 120-bit constant value. Not all stream ciphers have the same strength. It's important to understand how stream ciphers and the various approaches work, so organizations can select the right one. Stream ciphers are faster than block ciphers, so they're useful when speed is needed. They also use less processing power, so environments with minimal processing and power capabilities are a good fit. Finally, stream ciphers are better when short data streams or known length data streams are used, as in wireless. Block ciphers as I cover next can result in a lot of padded bits because they require a set block size for processing. Stream ciphers do not use padding. These are four examples of where stream ciphers are used.

Block Ciphers

Unlike stream ciphers, block ciphers process bit blocks of a specific size. Further, the keys used are fixed length and are not dependent upon the size of the plain text. Each bit block is processed multiple times or rounds to ensure a high level of entropy. The most commonly used block cipher is AES, standardized by the National Institute of Standards and Technology. AES uses a block size of 128 bits. Key sizes vary depending on which AES algorithm is used. Also, the number of iterations or rounds increases as the key size increases. AES ciphertext cannot be cracked at least not in any practical way. Access to the plaintext requires the key. The only way to crack the ciphertext is to steal or guess the key because use of 128 and 256 bit keys make it impractical to step through all possible keys in the keyspace using today's processor power. A keyspace is made up of all possible keys based on the key length. 128-bit key space includes this many keys. The AES 256 key space is far larger. This is a high-level look at how the AES 128 cipher works. We look at some of the methods used in AES and other block cipher approaches in upcoming slides. Note that AES is not just a simple application of a key. Further entropy is achieved by shifting bits, substituting bits, with an S-box, and rearranging bits with a P-box.

Substitution Box (S-Box)

This is an example of how an S-box works in DES. 6 bits are presented to the process. The first and last bits are stripped; these are called the outer bits, and they're used for table row selection. The middle four bits are compared to the table column headers. When a match is made, the process moves to the row with the outer bit match. The output is at the intersection. This is a very simple example. The substitution table in AES is generated during encryption and works a little differently, but the concept is the same. Input a value to a process that uses a table to substitute another value.

Permutation Box (P-Box)

Another process that can take place within each round of a block cipher is a permutation box or P-box. A P-box moves each bit in the input into another column. In the AES cipher, this is done after the block passes through the S-box and the bits are shifted. There are four basic block cipher modes.

Electronic Code Book (ECB)

Let's look at each. Electronic codebook or ECB is the simplest mode, and it is the least secure. Each block of plain text is processed individually. Because of the way each block is processed, blocks with the identical data produce the identical ciphertext. This reduces entropy. One advantage of ECB is the potential for multiple blocks to be processed across multiple processors. Another is the lack of propagation of input or cipher errors.

Cipher Block Chaining (CBC)

Cipher block chaining, CBC, removes the possibility of repeated cipher blocks by introducing an initialization vector or IV. Together with XORing of ciphertext, when encryption of the ciphertext begins, a random IV is created and XORed with the first block of plaintext. The resulting block is processed through the cipher steps. This continues until all blocks are processed.

Cipher Feedback Mode (CFB)

The cipher feedback mode CFB is almost identical to the CBC. The difference lies in what is XORed in each round. The CBC only XOR's the output of each round. The CFB XOR's all output from all previous rounds combined. This prevents one of the challenges in CBC: the propagation of errors. Another advantage of CFB is its ability to encrypt and decrypt in the same mode, encryption mode, while CBC must use both an encrypt and a decrypt mode. This can make CFB easier to implement. Finally, neither the CBC nor the cCFB can encrypt over parallel processors. This is an advantage of the next mode: counter mode.

Counter Cipher Mode (CTR)

Counter or CTR mode does not use XOR plaintext with previous encryption round. Instead, it uses a nonce and a counter. The counter is incremented for each block of plaintext passing through the cipher process. The counter is incremented for each block processed. The combination of the nonce and the counter is XORed with the plaintext block. This enables parallel processing of multiple blocks of plaintext.

Kerkhoff's Principle

An important principle on cryptography is Kerckhoff's principle. It states that security of a cipher should not depend on keeping the underlying algorithm or process secret. Instead, it should only rely on keeping the key secret. No cipher should rely on secrecy of how it works. Before any cipher algorithm is used, it should be reviewed and tested by as many cryptanalysts and cryptographers as possible. If a vendor tells you it used a proprietary private cipher to protect application data, look for another vendor.

When to use Symmetric Encryption

We use symmetric encryption when speed is important. It's used to encrypt and decrypt stored data. It can also be used in remote access protocols like TLS after the session key is established. In the next video, I look at an alternative although slower encryption method: asymmetric encryption. Well, that's it for this lesson. If you have questions, please ask. ...and until next time be careful once you click