Network Security

Confidentiality: only sender and intended receiver can read message contents

Authentication: sender and receiver confirm each other’s identity

Message integrity: Readonly; message sholdn’t be altered without detection

Access and availability: Services must be accessible to all users.

Threat model: what are the capabilities of the attackers/threat?

Terms

How to break an encryption scheme

  1. Cipher-text only attack (attacker only has ciphertext)
    1. Brute force (go through all possibilities in the search space)
    2. Statistical analysis (attempts to shrink the search space)
  2. Known-plaintext attack (attacker has some plaintexts and their ciphertexts)
  3. Chosen-plaintext (attakcer can get ciphertext for chosen plaintext)

Cryptographies

Symmetric key cryptography

Bob and Aliceshare same symmetric key $K_A = K_B$.

Substitution cipher

e.g. Monoalphabetic cipher. Substitution of one letter for another.

Drawbacks:

Caesar’s cipher

Rotates the alphabet (with wraparound) by a certain amount $k$.

Drawbacks:

n-cipher approach

Start with $n$ substitution ciphers $M_1, M_2, \dots, M_n$. Establish a cyclic permutation of ciphers e.g. $M_4, M_1, M_3, M_6, M_5, M_2, M_4, M_1, \dots$

For each next plaintext symbol, use the next substitution pattern.

Key: n substitution ciphers, cyclic pattern

Encryption standards

Block cipher: applies deterministic algo with symmetric key to encrypt blocks of text of fixed length.

DES: Data Encryption Standard

AES: Advanced Encryption Standard

Public Key Cryptography

\[K_B^-(K_B^+(m)) = K_B^+(K_B^-(m)) = m\]

Given public key $K_B^+$, should be impossible to compute $K_B^-$.

RSA

Message = bit pattern = integer number.

Public private key generation

  1. Choose 2 large primes $p, q$ (e.g. 1024 bits each)
  2. $n = pq$, $z = (p-1)(q-1)$
  3. Choose $e$ such that $e < n$ and $e, z$ are coprime
  4. Choose $d$ such that $ed \mod z = 1$
  5. Public key = $(n, e)$. Private key = $(n, d)$.

RSA encryption, decryption

Obtain $(n,e), (n,d)$.

To encrypt message $m$: $c = m^e \mod n$.

To decrypt cipher $c$: $m = c^d \mod n$.

Proof:

Remember: $n = pq, z = (p-1)(q-1)$.

\[\begin{aligned} m &= c^d \mod n\\ &= (m^e \mod n)^d \mod n\\ &= (m^{ed} \mod n) \mod n\\ &= (m^{(ed \mod z)} \mod n)\\ &= (m^1 \mod n)\\ &= m \end{aligned}\]

Exponentiation is expensive computationally.

Why is RSA secure:

Session keys

Use RSA to setup a secure encrypted channel, and exchange a symmetric key.

Then use symmetric key to encrypt and decrypt.

Digital Signatures

Establishment of authorship/ownership of a document

Must be verifiable, non-forgeable: so recepient can prove to owner that it is the intended recepient and that it has received.

Simple digital signature

Bob sends message $m$ and encrypted with private key $K^-_B(m)$.

Alice receives both and checks if $m = K^+_B(K^-_B(m))$.

So we know whoever signed $m$ must have used Bob’s private key (non-repudiation).

Message digest

$m$ is run through a hash function $H$ which gives us a digest $H(m)$.

Cannot use 1s complement checksum (aka Internet Checksum): has too many collisions.

Using hash function

Digest functions:

Criteria: Small change in input should lead to large change in digest.

Example – Password storage:

Certification Authorities

Public keys have to be known! Otherwise someone can replace the public key and say its mine when its really theirs (Impersonation).

Example of CA

Hence we have CAs

Encryption and decryption

TLS Handshake

TLS Handshake

  1. Client hello: Client sends client random
  2. Server hello: Server sends SSL cert + server random
  3. Authentication: Client verifies SSL cert with the CA’s public key.
  4. Premaster secret: Client sends a byte string with the public key extracted from the SSL cert
  5. Server decrypts secret with private key.
  6. Session keys: Both client and server generate session keys from client random, server random and premaster secret.
    1. Both client and server should arrive at the same results.
  7. Client and server send each other “finished” message encrypted with their session keys
  8. Handshake complete.

Chain of Trust

From end entity/domain, to Certification Authorities, to Root Certification Authorities

Virtual Private Networks

Firewalls

Isolates internal network, allowing some packets to pass but block others.

Three types of firewalls

Setting up policy rules, with which packets and filtered and dropped/forward if necessary.

Packet filtering types: