This commit is contained in:
John Gatward committed 2026-10-04 15:24:17 +01:00
1 parent d0f27f276b
commit d6f54d4ec2
103 files changed
+3663 -3779

No files matched your search

+18 -19
View File
@@ -2,8 +2,8 @@
- Symmetric encryption gives us confidentiality
- Implemented using block ciphers or stream ciphers
- Lightweight and fast
- Used for general communication
- Lightweight and fast
- Used for general communication
![1644517237.png](img/1644517237.png)
@@ -12,7 +12,7 @@
- Stream ciphers use an initial seed key to generate an infinite keystream of random looking bits
- The message and keystream are usually combined using an `xor` ($\oplus$) which is reversible if applied twice
- How ever using the same keystream to encrypt two messages makes messages easy to break
- However, using the same keystream to encrypt two messages makes messages easy to break
- A random *number used once* nonce is added as an additional seed
- The nonce is not a secret, it simply ensures the keystream is new
@@ -33,7 +33,7 @@
#### Block Ciphers
- Block ciphers use a key to encrypt a fixed size block of plain text into a *fixed-sized block* of cipher-text
- Changing and permuting the bits of the block depending on the key
- Changing and permuting the bits of the block depending on the key
- Different lengths of messages can be handled by splitting the message up, and padding
##### SP-Network
@@ -68,28 +68,28 @@
### Attack Models
1. Brute force
- Weakest attack, guessing the key
- If the key is $2^{128}$, on a super computer would take $10^9$ years
- Weakest attack, guessing the key
- If the key is $2^{128}$, on a supercomputer it would take $10^9$ years
2. Cipher text only
- Static analysis on the cipher text, frequency analysis etc
- e.g. looking at the enginma machine and recognising a letter cannot be itself
- Static analysis on the cipher text, frequency analysis etc
- e.g. looking at the Enigma machine and recognising a letter cannot be itself
3. Known plaintext
- Where you know some plaintext and the corresponding ciphertext
- e.g. Enigma being broken using “heil hitler”
- Where you know some plaintext and the corresponding ciphertext
- e.g. Enigma being broken using “heil hitler”
4. Chosen plaintext
- Seeing if certain plain-texts takes the algorithm longer/shorter
- Seeing if certain plain-texts take the algorithm longer/shorter
5. Chosen ciphertext
6. Related-key attack
- Get the same message encrypted in different keys
- More of a theoretical attack
- Get the same message encrypted in different keys
- More of a theoretical attack
Modern algorithms are expected to overcome these attacks trivially
## Asymmetric Encryption
- Two keys, a public & private key
- Public-key asymmetric cryptography hinges upon the premuse that:
- It is computationally infeasible to calculate a private key from a public key
- Public-key asymmetric cryptography hinges upon the premise that:
- It is computationally infeasible to calculate a private key from a public key
- In practice this is achieved through intractable mathematical problems
#### Key Exchange
@@ -104,17 +104,16 @@ It is extremely easy to go from a -> A but extremely difficult to go backwards.
#### Public key Encryption
- Client encrypts message with servers public key, now only the server’s private key can be used to read it.
- Client encrypts message with the server’s public key; now only the server’s private key can be used to read it.
- The authenticity of signatures generated by the private key can be verified by the public key
![1644519300.png](img/1644519300.png)
##### Public key Algorithms
| Algorithm | Key Exchange | Encryption | Digital Signitures | Mathematical Problem | Elliptic Curves | Typical Key Size |
| Algorithm | Key Exchange | Encryption | Digital Signatures | Mathematical Problem | Elliptic Curves | Typical Key Size |
| :------------- | :----------: | :--------: | :----------------: | --------------------- | :-------------: | ---------------- |
| Diffie-Hellmen | ✅ | ❌ | ❌ | Discrete Logs | ✅ | 256 |
| Diffie-Hellman | ✅ | ❌ | ❌ | Discrete Logs | ✅ | 256 |
| `RSA` | ❌ | ✅ | ✅ | Integer Factorisation | ❌ | 2048/4096 |
| `Elgamal` | ❌ | ✅ | ✅ | Discrete Logs | ✅ | 2048 |
| `DSA` | ❌ | ❌ | ✅ | Discrete Logs | ✅ | 256 |