06. Cryptography 101

Anyone who tries to create his or her own cryptographic primitive is either a genius or a fool. Given the genius/fool ratio of our species, the odds aren’t very good.

Bruce Schneier

Current Events: Experian

Experian: US credit score service.

Past month:

Principles

Security protocols are more than passwords.

At the core, security protocols are about preventing malicious people from doing bad things.

Security protocols exist outside of software:

Eavesdropping risks:

Simple Authentication Principle

Notation:

TG:T,{T,N}KT T \rightarrow G : T, \left\{ T, N \right\}_{KT}

Where:

The nonce is used to prevent replay attacks.

Challenge and Response

Often used by car transponders:

ET:NTE:T,{T,N}KT \begin{aligned} E \rightarrow T &: N \\ T \rightarrow E &: T, \left\{ T, N \right\}_{KT} \end{aligned}

Where:

Early 2FA

SU:NUP:N,PINPU:{N,PIN}KUS:{N,PIN}K \begin{aligned} S \rightarrow U &: N \\ U \rightarrow P &: N, \text{PIN} \\ P \rightarrow U &: \left\{ N, \text{PIN} \right\}_K \\ U \rightarrow S &: \left\{ N, \text{PIN} \right\}_K \end{aligned}

Where:

Physical 2FA Devices

A physical device is used to generate authentication numbers:

Generation algorithm (protocol):

Reflection Attack

Adversary finds a legitimate ‘password’ generator and then performs a MITM attack.

SA:NAU:NUA:{N}KAS:{N}K \begin{aligned} S \rightarrow A &: N \\ A \rightarrow U &: N \\ U \rightarrow A &: \left\{ N \right\}_K \\ A \rightarrow S &: \left\{ N \right\}_K \end{aligned}

Where:

Failures

Failures are often in the protocol:

Reducing the amount of failures:

General Encryption Principles

C=E(P,K)P=D(C,K)P=D(E(P,K),K) \begin{aligned} C =& E(P, K) \\ P =& D(C, K') \\ P =& D(E(P, K), K') \end{aligned}

Where:

Examples:

Cipher Examples

Ceasar Cipher:

Vernam cipher:

Playfair block cipher:

Feistel cipher:

Hash functions and control keys:

Key Management

User-defined keys are relatively weak:

Public key infrastructure: