Lecture 6

Introductions

Encryption:

Cryptoanalysis

Certain encryption approaches can also be used for authentication

Cipher

Plain text

Key space

Stream cipher

Going dark problem - great for privacy

Cryptography

Two main paradigms (both heavily used): Private key (symmetric) and Public key (asymmetric)

alt text

Symmetric key (private key)

Public key (asymmetric encryption)

Take plain text, and encrypt with private key

Other way around (rightmost)

The Caesar cipher

The Caesar cipher (100 BC) is one of the earliest known and simplest ciphers. It is a type of substitution cipher in which each letter in the plaintext is 'shifted' a certain number of places down the alphabet. For example, with a shift of 3, A would be replaced by D, B would become E, and so on.

alt text

How to create

The basic idea behind a stream cipher is to generate a keystream – a sequence of bits or bytes – that is then combined with the plaintext to produce the ciphertext. The keystream is generated based on an initial key and, often, an additional value called an Initialization Vector (IV).

alt text

Perform the XOR cipher a second time

Stream cipher - Application

RC4: One of the most well-known stream ciphers, RC4, was widely used in protocols like SSL/TLS and WEP. However, RC4 is now considered insecure due to several vulnerabilities and should be avoided.

Salsa20/ChaCha20: These are modern stream ciphers that are designed to be secure, fast, and efficient. ChaCha20, for example, is used in the HTTPS protocol for securing web traffic.

alt text

Block cipher (operates on fixed length groups of bits called blocks)

A block cipher is a type of symmetric encryption algorithm that encrypts data in fixed-size blocks, typically 64 or 128 bits at a time. It is one of the fundamental building blocks of modern cryptography, widely used to secure data in various applications, including SSL/TLS for internet security, disk encryption, and more.

Two widely used block cipher algorithms: AES (Advanced Encryption Standard) and DES (Data Encryption Standard).

DES (Data Encryption Standard)

DES is one of the earlier block cipher algorithms developed in the 1970s. It operates on 64-bit blocks and uses a 56-bit key. DES uses a 16-round Feistel structure†, a common design pattern for block ciphers, where each round involves substitution, permutation, and mixing with the key.

AES (Advanced Encryption Standard)

AES is the current standard for block ciphers, designed to be secure and efficient. It supports key sizes of 128, 192, or 256 bits and operates on 128-bit blocks.

AES

AES Encryption Process

  1. Key Expansion: The original key is expanded into multiple round keys using a key schedule algorithm.
  2. Initial Round:
  3. AddRoundKey: The plaintext block is XORed with the first round key.
  4. Main Rounds (9, 11, or 13 rounds, depending on the key size):
  5. SubBytes: Each byte of the block is replaced with a corresponding byte from an S-box (substitution box) for non-linear substitution.
  6. ShiftRows: Rows of the block are shifted cyclically to the left to introduce diffusion.
  7. MixColumns: Columns of the block are mixed using linear transformation to further spread the plaintext information across the block.
  8. AddRoundKey: The block is XORed with a round key derived from the original key.
  9. Final Round: The last round omits the MixColumns step and consists of SubBytes, ShiftRows, and AddRoundKey operations. Decryption Process AES decryption is performed using the inverse operations of encryption, with the round keys applied in reverse order.

alt text

Symmetric key algorithms

Symmetric key cryptography is the oldest form but still heavily used. Simple definition:

Note: We are not discussing the details of the variations on these two ciphers, the Vigenere cipher (1553) or Vernam cipher (1917). However, some interactive tools exist to encrypt and decrypt the Vigenere cipher and others on the Internet:

Substitution Example

Decrypt the following line of cipher text (a simple substitution cipher with a three character key has been used). Use the underscore character (_) to represent the space character.

ehtwrmsrohsrmtnsyehtwrmsrohsrmtnsy

The key used in the above encryption strategy is space => r e => s o => t

c) The algorithm for the above encryption and decryption strategy Starting with the first character, consider each letter of the cipher/plain text in turn. If the letter appears in the key, make the substitution – else leave the letter unchanged. Move to the next letter.

Answer: show_me_the_money

Cryptanalysis of substitution

The most frequently occurring letters in the English language, in order of decreasing frequency, are: <space>, E, T, A, O, I, N, S, H, R, D, L, U, C, M, F, Y, W, G, P, B, V, K, X, J, Q, Z

ehtwrmsrohsrmtnsyehtwrmsrohsrmtnsy

So cryptoanalysis of the cypher text would quickly see that R is the most commonly occuring character. In English language the most commonly occuring character in a block of text is the space. So immediately, if we were using cryptanalysis to try and hack, this we would quickly try R being replaced by the space.

ehtwmsohsmtnsyehtw ms ohs mtnsy

And immediately we would break the cypher text into words. And by simple trial and error approach, we would quickly deduce that {space => r, e => s, o => t} is the encryption/decryption key.

showmethemoneyshow me the money

So, the point is that this type of encryption can be vulnerable to what we call frequency distribution in the underlying language, that means that cryptanalysis of this cypher text is easily produced.

Transposition Example

f) Decrypt the following line of cipher text (a simple transposition cipher with a four character key has been used). The underscore character (_) represents the space character.

isheamnisnohj_isheamn_is_nohj

g) The key used in the above encryption strategy is {1234 becomes 4231} That is, within each block of four characters, the first and fourth characters are swapped.

isheamnisnohj_ish eamn _is_ nohj

Is the cipher used above block or stream and is it symmetric or asymmetric?

hisnameisjohnhis_ name _is_ john

Cryptographic Algorithms

Symmetric encryption Uses same “secret key” (also known as private key) for encoding and decoding

Consider how your access to the UQ network was initially set up

The ‘key distribution’ problem

Consider your access to the UQ computing infrastructure – what is the ‘key’, how is key granting and key distribution administered – the significance (difficulty/cost) of ‘out of band’ solutions

Symmetric key cryptography

alt text

Encrypting binary data

alt text

To encrypt this we select an encryption key that will also be stored in binary format – so we end up with all binary data!

Full ASCII Table

alt text

alt text

Encryption algorithm

Encrypting CAT as VVV

alt text

Cipher strength

AES, a sample of symmetric encryption, is very strong. The use of 128- and 256-bit keys makes it impervious to cracking. Contrary to movies and TV, the only way to get unauthorised access to AES encrypted information is to steal or guess the key.

Guessing is impractical due to the number of possible keys. A 128-bit key has 2^128 =
340,282,366,920,938,463,463,374,607,431,768,211,456 possible keys.

An n-bit key has 2^n possible keys because for each of the n bits, we have 2 options (0 or 1).

Cipher/key-length strength

alt text

Data Encryption Standard (DES)

64 bit block size, 56 bit key size (fixed), multiple rounds, key is changed with each round, output from one round forms the input to the next – uses SUBSTITUTION and transposition

alt text

Symmetric key algorithmns

Summary: Symmetric Key Cryptography

Hashing (cryptographic hash functions)

Generates fixed length fingerprints of arbitrarily large messages.

alt text

Difference Between Hashing and Encryption

alt text

Hash functions

alt text

alt text

Summary: Hash functions

Public key cryptography (asymmetric cryptography) and digital signatures

Overview

Asymmetric cryptography – the theory

Asymmetric cryptography – the practice (1)

alt text

alt text

  1. Next, Alice creates a sensitive document, encrypts it with Bob’s public key, and sends it to Bob. Once she has encrypted this document, Alice cannot decrypt it (why?).
  2. Upon receipt of the encrypted document, Bob uses his private key to decrypt it.

alt text

Digital signatures are using asymmetric cryptography

How to create a digital signature

alt text

alt text

Question: how does ‘integrity’, ‘authentication’ and ‘non-repudiation’ apply in the above example? Do we have confidentiality?