mirror of
https://github.com/autistic-symposium/sec-pentesting-toolkit.git
synced 2025-11-27 06:36:19 -05:00
ciphers are fun
This commit is contained in:
parent
6872b670ca
commit
4ec0c839e2
1 changed files with 78 additions and 57 deletions
|
|
@ -1,21 +1,25 @@
|
||||||
# Cryptography
|
# Cryptography
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
Often data is just encoded in base64 or hex. Other times it's just compressed (gzip):
|
Often data is just encoded in base64 or hex. Other times it's just compressed (gzip):
|
||||||
|
|
||||||
* Text 32 characters long --> md5 hash.
|
* Text 32 characters long --> md5 hash.
|
||||||
* 40 characters long --> SHA1 hash.
|
* 40 characters long --> SHA1 hash.
|
||||||
* equal signs spread --> base64 encoded string.
|
* equal signs spread --> base64 encoded string.
|
||||||
* text only letters, without numbers or special characters --> Caesar, Vigenere, or other type of cipher.
|
* text only letters, without numbers or special characters --> Caesar, Vigenere, or other type of cipher.
|
||||||
* hints about keys and signing --> likely RSA.
|
* hints about keys and signing --> likely RSA.
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## MD5
|
## MD5
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
- The [MD5 hashing algorithm](http://www.fastsum.com/support/md5-checksum-utility-faq/md5-hash.php) always returns 128 bit values, so the chance that two randomly chosen objects have the same hash is 1:2**128.
|
- The [MD5 hashing algorithm](http://www.fastsum.com/support/md5-checksum-utility-faq/md5-hash.php) always returns 128 bit values, so the chance that two randomly chosen objects have the same hash is 1:2**128.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* Command Line:
|
* Command Line:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -26,24 +30,25 @@ $ echo -n password | md5sum
|
||||||
* Or you can use Python's md5.md5().digest()
|
* Or you can use Python's md5.md5().digest()
|
||||||
|
|
||||||
- md5 hashes: [here](http://hash-killer.com/), [here](http://www.md5this.com/), [here](http://www.hashkiller.co.uk/).
|
- md5 hashes: [here](http://hash-killer.com/), [here](http://www.md5this.com/), [here](http://www.hashkiller.co.uk/).
|
||||||
|
|
||||||
- [md5sum](http://linux.about.com/library/cmd/blcmdl1_md5sum.htm)
|
- [md5sum](http://linux.about.com/library/cmd/blcmdl1_md5sum.htm)
|
||||||
- [md5 creator](http://www.md5-creator.com/)
|
- [md5 creator](http://www.md5-creator.com/)
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Scripts Available
|
### Scripts Available
|
||||||
|
|
||||||
- Hash length extension attack
|
- Hash length extension attack
|
||||||
- Brute force hex digest chars
|
- Brute force hex digest chars
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
------
|
------
|
||||||
|
|
||||||
## SHA
|
## SHA
|
||||||
|
|
||||||
- SHA-1 has output size of 160 bits, so chances of collisions are 2**160.
|
<br>
|
||||||
|
|
||||||
|
- SHA‑1 has an output size of `160` bits, so the expected number of collision possibilities is 2^160.
|
||||||
- [Hash maker](http://ratfactor.com/sha1).
|
- [Hash maker](http://ratfactor.com/sha1).
|
||||||
|
|
||||||
### Scripts
|
### Scripts
|
||||||
|
|
@ -62,29 +67,31 @@ for a, b, c, d, e, f in itertools.product(ch, ch, ch, ch, ch, ch):
|
||||||
print 'ASIS_a9%s00f497f2eaa4372a7fc21f0d' % (a + b + c + d + e + f)
|
print 'ASIS_a9%s00f497f2eaa4372a7fc21f0d' % (a + b + c + d + e + f)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
--------
|
--------
|
||||||
|
|
||||||
## Rotation Ciphers
|
## Rotation Ciphers
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Scripts
|
### Scripts
|
||||||
|
|
||||||
- Caesar
|
- Caesar
|
||||||
- Brute force rotation
|
- Brute force rotation
|
||||||
- Pygenere
|
- Pygenere
|
||||||
- Frequency analysis
|
- Frequency analysis
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Online tools:
|
### Online tools:
|
||||||
|
|
||||||
- Frequency analysis: [here](http://www.simonsingh.net/The_Black_Chamber/hintsandtips.html) and [here](http://www.xarg.org/tools/caesar-cipher)
|
- Frequency analysis: [here](http://www.simonsingh.net/The_Black_Chamber/hintsandtips.html) and [here](http://www.xarg.org/tools/caesar-cipher)
|
||||||
|
|
||||||
- [Cesar Cipher decryption](http://www.xarg.org/tools/caesar-cipher/) and [here](http://tools.zenverse.net/caesar-cipher/).
|
- [Cesar Cipher decryption](http://www.xarg.org/tools/caesar-cipher/) and [here](http://tools.zenverse.net/caesar-cipher/).
|
||||||
|
|
||||||
- [Vigenere Cipher breaker](http://www.mygeocachingprofile.com/codebreaker.vigenerecipher.aspx) and [here](http://smurfoncrack.com/pygenere/index.php).
|
- [Vigenere Cipher breaker](http://www.mygeocachingprofile.com/codebreaker.vigenerecipher.aspx) and [here](http://smurfoncrack.com/pygenere/index.php).
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### In the terminal...
|
### In the terminal...
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
@ -93,76 +100,88 @@ $ echo "$VAR"
|
||||||
$ alias rot13="tr A-Za-z N-ZA-Mn-za-m"
|
$ alias rot13="tr A-Za-z N-ZA-Mn-za-m"
|
||||||
$ echo "$VAR" | rot13
|
$ echo "$VAR" | rot13
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### In Python...
|
### In Python...
|
||||||
|
|
||||||
In Python [we can use decoding](https://docs.python.org/2/library/codecs.html#codec-base-classes):
|
In Python [we can decode](https://docs.python.org/2/library/codecs.html#codec-base-classes):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"YRIRY GJB CNFFJBEQ EBGGRA".decode(encoding="ROT13")
|
"YRIRY GJB CNFFJBEQ EBGGRA".decode(encoding="ROT13")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Readings:
|
### Readings:
|
||||||
|
|
||||||
- [How Vigenere works](http://sharkysoft.com/vigenere/).
|
- [How Vigenere works](http://sharkysoft.com/vigenere/).
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## RSA
|
## RSA
|
||||||
|
|
||||||
* Public-key cryptosystem which uses a public-private key pair to encrypt and decrypt information securely
|
<br>
|
||||||
|
|
||||||
|
* A public‑key cryptosystem that uses a public‑private key pair to encrypt and decrypt information securely
|
||||||
* [RSA Python](https://pypi.python.org/pypi/rsa)
|
* [RSA Python](https://pypi.python.org/pypi/rsa)
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Pailier Cryptosystem
|
## Pailier Cryptosystem
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Scripts
|
### Scripts
|
||||||
|
|
||||||
- POC
|
- POC
|
||||||
- Primes
|
- Primes
|
||||||
|
|
||||||
---
|
<br>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Scripts
|
### Scripts
|
||||||
|
|
||||||
- Finding GDC
|
- Finding GCD
|
||||||
- Finding if prime
|
- Finding if prime
|
||||||
- Generate prime
|
- Generate prime
|
||||||
- Quick Select
|
- Quick Select
|
||||||
- XORtool
|
- XORtool
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Other Resources
|
### Other Resources
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
- [Cryptol](https://www.cryptool.org/en/cryptool1-en)
|
- [Cryptol](https://www.cryptool.org/en/cryptool1-en)
|
||||||
|
|
||||||
- [PyCrypto](https://www.dlitz.net/software/pycrypto/)
|
- [PyCrypto](https://www.dlitz.net/software/pycrypto/)
|
||||||
|
|
||||||
- hashpump
|
- hashpump
|
||||||
|
|
||||||
- Sage
|
- Sage
|
||||||
|
|
||||||
- John the Ripper
|
- John the Ripper
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
#### Carperter's Formula
|
#### Carperter's Formula
|
||||||
|
|
||||||
- Very large number: ```bin``` and check if patterns. For example, using the [Carpenter's Formula]:
|
- Very large number: convert to ```bin``` and check for patterns. For example, using the [Carpenter's Formula]:
|
||||||
```
|
```
|
||||||
N=(2^M + a)(2^N + b)(2^N + c)(2^N + d)
|
N=(2^M + a)(2^N + b)(2^N + c)(2^N + d)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
#### [QR Code]
|
#### [QR Code]
|
||||||
|
|
||||||
- Version 1 QR code: 21x21
|
- Version 1 QR code: 21x21
|
||||||
|
|
@ -173,11 +192,11 @@ babaaaabaaababaababaaaabbabbababbaaaabaaaabbbaabaabaaaaaabaaabaaabaaabaaabbaabaa
|
||||||
```
|
```
|
||||||
* [Online tool](http://www.geocachingtoolbox.com/index.php?page=baconianCipher)
|
* [Online tool](http://www.geocachingtoolbox.com/index.php?page=baconianCipher)
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
#### [Base64]:
|
#### [Base64]:
|
||||||
|
|
||||||
Base64 is a non-readable encoding that encodes arbitrary 8-bit input using 6-bit alphabet of case sensitive alphanumerics, "+", "/". Every 3 bytes of input map to 4 bytes of output. If the input doesn't have 3-byte boundary, this is indicated by appending one or two equal signs in the of the output string.
|
Base64 is a non-readable encoding that encodes arbitrary 8-bit input using 6-bit alphabet of case sensitive alphanumerics, "+", "/". Every 3 bytes of input map to 4 bytes of output. If the input length is not a multiple of 3 bytes, this is indicated by appending one or two equal signs at the end of the output string.
|
||||||
|
|
||||||
- [Base64 Decoder](http://www.base64decode.org)
|
- [Base64 Decoder](http://www.base64decode.org)
|
||||||
|
|
||||||
|
|
@ -194,8 +213,9 @@ Nzk0czAwIHRueXMgZmhidnByZWMgZWhiIHNiIGdlbmMgcWV2dWcgcnVnIGhibCBnYXJmcmVjIFYgbG9y
|
||||||
'oubWYf2kBq'
|
'oubWYf2kBq'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Hexadecimal & ASCII:
|
<br>
|
||||||
|
|
||||||
|
#### Hexadecimal & ASCII:
|
||||||
|
|
||||||
Hex character codes are simply the hexadecimal (base 16) numbers for the ASCII character set; that is, the number-to-letter Representations which comprise virtually all computer text.
|
Hex character codes are simply the hexadecimal (base 16) numbers for the ASCII character set; that is, the number-to-letter Representations which comprise virtually all computer text.
|
||||||
|
|
||||||
|
|
@ -203,8 +223,6 @@ Hex character codes are simply the hexadecimal (base 16) numbers for the ASCII c
|
||||||
- [Convert All](http://www.asciitohex.com/)
|
- [Convert All](http://www.asciitohex.com/)
|
||||||
- [GREAT ASCII CHART](http://www.jimprice.com/jim-asc.shtml)
|
- [GREAT ASCII CHART](http://www.jimprice.com/jim-asc.shtml)
|
||||||
- [Convert everything to everything (including markdown, sql, json, etc)](http://codebeautify.org/)
|
- [Convert everything to everything (including markdown, sql, json, etc)](http://codebeautify.org/)
|
||||||
|
|
||||||
|
|
||||||
- ASCII to hex:
|
- ASCII to hex:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
@ -230,6 +248,8 @@ $ python -c 'print "2f722f6e6574736563".decode("hex")'
|
||||||
$ xxd -r -p <<< 2f722f6e6574736563
|
$ xxd -r -p <<< 2f722f6e6574736563
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Binary
|
### Binary
|
||||||
|
|
||||||
- Decimal to binary
|
- Decimal to binary
|
||||||
|
|
@ -239,13 +259,19 @@ $ xxd -r -p <<< 2f722f6e6574736563
|
||||||
'0b11110010101001010'
|
'0b11110010101001010'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
#### Octal
|
#### Octal
|
||||||
|
|
||||||
Commonly used in obscuration of URLs. Example: http://017700000001 --> 127.0.0.1
|
Commonly used in obfuscation of URLs. Example: http://017700000001 --> 127.0.0.1
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## OpenSSL, Encoding and Certificates
|
## OpenSSL, Encoding and Certificates
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
* Identification and verification of SSL certificates can be done with openssl or
|
* Identification and verification of SSL certificates can be done with openssl or
|
||||||
TLSSLed tools. They allow us to verify this information automatically SSL.
|
TLSSLed tools. They allow us to verify this information automatically SSL.
|
||||||
|
|
@ -263,25 +289,27 @@ $ ./openssl s_client --no_tls1 --no_ssl3 --connect <WEBSITE>:443
|
||||||
|
|
||||||
* For Identification and verification of encoding supported by the Website we can use **EcoScan34**.
|
* For Identification and verification of encoding supported by the Website we can use **EcoScan34**.
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Block Cipher Encryption
|
## Block Cipher Encryption
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
* Electronic code book (ECB) mode.
|
* Electronic code book (ECB) mode.
|
||||||
* Simplest and default block cipher mode.
|
* Simplest and default block cipher mode.
|
||||||
* Message is split into blocks and each is encrypted separately.
|
* Message is split into blocks and each is encrypted separately.
|
||||||
* Disadvantage: identical plaintext block encrypts to identical cipher text block (for example, figures).
|
* Disadvantage: identical plaintext block encrypts to identical cipher text block (for example, figures).
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
### Attacking Randomness
|
### Attacking Randomness
|
||||||
|
|
||||||
* Good Randomness is vital for cryptographic operations.
|
* Good Randomness is vital for cryptographic operations.
|
||||||
|
|
||||||
* Two common attack against a PRNG :
|
* Two common attacks against a PRNG :
|
||||||
- PRGN state is reconstructed from its output.
|
- PRNG state is reconstructed from its output.
|
||||||
- Same PRNG is used more than once.
|
- Same PRNG is used more than once.
|
||||||
|
|
||||||
* Statistically random is not secure random!
|
* Statistically random is not secure random!
|
||||||
|
|
@ -289,15 +317,12 @@ $ ./openssl s_client --no_tls1 --no_ssl3 --connect <WEBSITE>:443
|
||||||
|
|
||||||
* Seed race condition attacks:
|
* Seed race condition attacks:
|
||||||
- System clock often used to seed PRNG
|
- System clock often used to seed PRNG
|
||||||
- Submit 10's or 100's of requests at a time. Seed a PRNG with the same system clock and the output will be the same.
|
- Submit 10's or 100's of requests at a time. If a PRNG is seeded using the system clock, simultaneous requests may receive identical seeds and therefore identical output.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[SHA]:http://en.wikipedia.org/wiki/Secure_Hash_Algorithm
|
[SHA]:http://en.wikipedia.org/wiki/Secure_Hash_Algorithm
|
||||||
[MD5]: http://en.wikipedia.org/wiki/MD5
|
[MD5]: http://en.wikipedia.org/wiki/MD5
|
||||||
[Base64]: http://en.wikipedia.org/wiki/Base64
|
[Base64]: http://en.wikipedia.org/wiki/Base64
|
||||||
|
|
@ -312,17 +337,21 @@ $ ./openssl s_client --no_tls1 --no_ssl3 --connect <WEBSITE>:443
|
||||||
[namechk]: http://namechk.com
|
[namechk]: http://namechk.com
|
||||||
[QR Code]: http://en.wikipedia.org/wiki/QR_code
|
[QR Code]: http://en.wikipedia.org/wiki/QR_code
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Cryptography Glossary
|
## Cryptography Glossary
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
* **Symmetric encryption (shared key encryption)**: all authorized parties have the same key. It has no means for verifying the sender of a message among any group of shared key users.
|
* **Symmetric encryption (shared key encryption)**: all authorized parties have the same key. It has no means for verifying the sender of a message among any group of shared key users.
|
||||||
|
|
||||||
* **Block Chaining (CBC)**: operates on blocks of symbols. It's the only appropriate fixed-block cipher in use. If performs an XOR operation with the previous block of data. Most encryption is done by using block ciphers.
|
* **Block Chaining (CBC)**: operates on blocks of symbols. It's the only appropriate fixed-block cipher in use. It performs an XOR operation with the previous block of data. Most encryption is done by using block ciphers.
|
||||||
|
|
||||||
* **Modes of Operation of a Block Cipher**: there are four modes of operation:
|
* **Modes of Operation of a Block Cipher**: there are four modes of operation:
|
||||||
1. **electronic code book** (ECB): The standard mode. It has the disadvantage that for a given key, two identical plaintexts will correspond to identical ciphertexts.
|
1. **electronic code book** (ECB): The standard mode. It has the disadvantage that for a given key, two identical plaintexts will correspond to identical ciphertexts.
|
||||||
2. ** cipherblock chaining ** (CBC): The most commonly used. Agreement on a non-secret **initialization vector** (of same length as the plaintext).
|
2. **Cipher Block Chaining** (CBC): The most commonly used. Agreement on a non-secret **initialization vector** (of same length as the plaintext).
|
||||||
3. **cipher feedback** (CFB): if the plaintext is coming in slowly, the ciphertext can be sent as soon as the plaintext comes in.
|
3. **cipher feedback** (CFB): if the plaintext is coming in slowly, the ciphertext can be sent as soon as the plaintext comes in.
|
||||||
4. **output feedback** (OFB): a way to create a keystream for a stream cipher.
|
4. **output feedback** (OFB): a way to create a keystream for a stream cipher.
|
||||||
|
|
||||||
|
|
@ -330,7 +359,6 @@ $ ./openssl s_client --no_tls1 --no_ssl3 --connect <WEBSITE>:443
|
||||||
|
|
||||||
* **The Advanced Encryption Standard (AES)**: introduced in 2002. It operates on 128 bit strings. AES has 128 bit key and 128 bit ciphertext and plain text blocks. So when AES is used to encrypt a text message, it encrypts blocks of 128/8 = 16 symbols. It alternates 10 substitutions with 10 transpositions.
|
* **The Advanced Encryption Standard (AES)**: introduced in 2002. It operates on 128 bit strings. AES has 128 bit key and 128 bit ciphertext and plain text blocks. So when AES is used to encrypt a text message, it encrypts blocks of 128/8 = 16 symbols. It alternates 10 substitutions with 10 transpositions.
|
||||||
|
|
||||||
|
|
||||||
* **Stream Ciphers**: operates symbol-by-symbol. Block ciphers can run in modes that allow them to operate arbitrary size chunks of data. The counter CTR mode cipher is the best choice for a stream cipher. Modern stream ciphers are symmetric key cryptosystems.
|
* **Stream Ciphers**: operates symbol-by-symbol. Block ciphers can run in modes that allow them to operate arbitrary size chunks of data. The counter CTR mode cipher is the best choice for a stream cipher. Modern stream ciphers are symmetric key cryptosystems.
|
||||||
|
|
||||||
* **Synchronous stream cipher**: when you simply XOR the plaintext with the keystream to get the ciphertext.
|
* **Synchronous stream cipher**: when you simply XOR the plaintext with the keystream to get the ciphertext.
|
||||||
|
|
@ -345,9 +373,6 @@ $ ./openssl s_client --no_tls1 --no_ssl3 --connect <WEBSITE>:443
|
||||||
|
|
||||||
* **One-time pads**: the keystream is never used again. If each bit of the keystream is truly randomly generated, this implies that each bit is independent of the previous bits. So you don't start with a seed/key that is short and generate a keystream from it (ex: flipping a coin).
|
* **One-time pads**: the keystream is never used again. If each bit of the keystream is truly randomly generated, this implies that each bit is independent of the previous bits. So you don't start with a seed/key that is short and generate a keystream from it (ex: flipping a coin).
|
||||||
|
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
* **Asymmetric encryption (public key encryption)**: each party has a different set of keys for accessing the same encrypted data. Main uses:
|
* **Asymmetric encryption (public key encryption)**: each party has a different set of keys for accessing the same encrypted data. Main uses:
|
||||||
1. Agree on a key for a symmetric cryptosystem.
|
1. Agree on a key for a symmetric cryptosystem.
|
||||||
2. Digital signatures.
|
2. Digital signatures.
|
||||||
|
|
@ -361,7 +386,7 @@ $ ./openssl s_client --no_tls1 --no_ssl3 --connect <WEBSITE>:443
|
||||||
1. Bob picks p, q primes around 1e150.
|
1. Bob picks p, q primes around 1e150.
|
||||||
2. He computes n = pq ~ 1e300 and f(n)=(p-1)(q-1).
|
2. He computes n = pq ~ 1e300 and f(n)=(p-1)(q-1).
|
||||||
3. He finds some number e with gcd(e, f(n)) = 1 and computes 1/e mod f(n) = d.
|
3. He finds some number e with gcd(e, f(n)) = 1 and computes 1/e mod f(n) = d.
|
||||||
4. He publishes (n,e) and keep d, p, q hidden.
|
4. He publishes (n,e) and keeps d, p, q hidden.
|
||||||
5. Alice wants to send Bob the plaintext M (maybe an AES key) enconded as a number 0<=M<n. If the message is longer than n, she breaks into blocks..
|
5. Alice wants to send Bob the plaintext M (maybe an AES key) enconded as a number 0<=M<n. If the message is longer than n, she breaks into blocks..
|
||||||
6. Alice looks up Bob's n,e and reduces M^e mod n = C, sending C to Bob.
|
6. Alice looks up Bob's n,e and reduces M^e mod n = C, sending C to Bob.
|
||||||
7. Bob reduces C^d mod n to get M because C^d = (M^e)^d = M
|
7. Bob reduces C^d mod n to get M because C^d = (M^e)^d = M
|
||||||
|
|
@ -387,7 +412,7 @@ In the early 1990’s, it was common to use 512 bits (n ~ 1e154). An RSA challen
|
||||||
|
|
||||||
* **Elliptic Curve Cryptography** (ECC): it has much shorter keys (1/6 bits) than RSA with the same security. It's useful in terms of key agreement and minimal storage computations (such as smart cards).
|
* **Elliptic Curve Cryptography** (ECC): it has much shorter keys (1/6 bits) than RSA with the same security. It's useful in terms of key agreement and minimal storage computations (such as smart cards).
|
||||||
- An elliptic curve is a curve described an equation y^2 + a_1 xy + a_3 y = x^3 + a_2 x^2 + a_4 x + a_6.
|
- An elliptic curve is a curve described an equation y^2 + a_1 xy + a_3 y = x^3 + a_2 x^2 + a_4 x + a_6.
|
||||||
- All cublic curves can be brought to this form by a change of variables. The curve closes off in the infinite or zero point.
|
- All cubic curves can be brought to this form by a change of variables. The curve includes a point at infinity.
|
||||||
|
|
||||||
* **Elliptic Curve Diffie Hellman** (ECDH): chose a finite field, fix some elliptic curve with coefficients in this field , and a pseudo generator point. Each user has a private number and a public key point.
|
* **Elliptic Curve Diffie Hellman** (ECDH): chose a finite field, fix some elliptic curve with coefficients in this field , and a pseudo generator point. Each user has a private number and a public key point.
|
||||||
|
|
||||||
|
|
@ -414,9 +439,6 @@ replace the known IV with a secret shared key.
|
||||||
|
|
||||||
* **SHA3**: chosen by NIST in 2012, it has the strongly collision free property. SHA-3 takes inputs of arbitrary length and gives output of length 256.
|
* **SHA3**: chosen by NIST in 2012, it has the strongly collision free property. SHA-3 takes inputs of arbitrary length and gives output of length 256.
|
||||||
|
|
||||||
|
|
||||||
-----------
|
|
||||||
|
|
||||||
* **Internet security**: there are two main protocols for providing security in the internet (encryption and authentication): TLS and IPSec.
|
* **Internet security**: there are two main protocols for providing security in the internet (encryption and authentication): TLS and IPSec.
|
||||||
|
|
||||||
* **Transport Layer Security**: the process is called Secure Sockets Layer (SSL) and now being replaced by TLS. RSA to agree on AES key (which is used to encrypt password for example).
|
* **Transport Layer Security**: the process is called Secure Sockets Layer (SSL) and now being replaced by TLS. RSA to agree on AES key (which is used to encrypt password for example).
|
||||||
|
|
@ -427,7 +449,7 @@ replace the known IV with a secret shared key.
|
||||||
|
|
||||||
* **Kerberos**: third part authentication protocol for insecure closed systems. It is used to prove someone's identity (authentication) in a secure manner without a public key crypto. An authentication server authenticates the client identity with a ticket granting service for a service.
|
* **Kerberos**: third part authentication protocol for insecure closed systems. It is used to prove someone's identity (authentication) in a secure manner without a public key crypto. An authentication server authenticates the client identity with a ticket granting service for a service.
|
||||||
|
|
||||||
* **Salt**: random value added to a message so that two messages don't generate the same hash value. It must not be duplicated between messages. It must be stored in addition to the hash so that the digest can be reconstructed. It must be protected. A salt of 23 buts increase of the password pre-computation dictionary by 4 billions of time (2^32).
|
* **Salt**: random value added to a message so that two messages don't generate the same hash value. It must not be duplicated between messages. It must be stored in addition to the hash so that the digest can be reconstructed. It must be protected. A salt of 32 bits increases the size of the password pre‑computation dictionary by 4 billion times (2^32).
|
||||||
|
|
||||||
- Salt is a string that is concatenated to a password. It should be different for each userid. It is public for non-SSL/TLS applications like KERBEROS and UNIX.
|
- Salt is a string that is concatenated to a password. It should be different for each userid. It is public for non-SSL/TLS applications like KERBEROS and UNIX.
|
||||||
|
|
||||||
|
|
@ -437,11 +459,8 @@ replace the known IV with a secret shared key.
|
||||||
|
|
||||||
* **Rainbow tables**: example of how a lack of salt value leaves password hashes vulnerable to pre-computation attacks.
|
* **Rainbow tables**: example of how a lack of salt value leaves password hashes vulnerable to pre-computation attacks.
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
* **Quantum Cryptography**: there are two ways of agreeing on a symmetric keys without presence: public key crypto or quantum crypto. It can work up to several kilometers. It can detect eavesdropping.
|
* **Quantum Cryptography**: there are two ways of agreeing on a symmetric keys without presence: public key crypto or quantum crypto. It can work up to several kilometers. It can detect eavesdropping.
|
||||||
- A photon has a polarization that can be measured on any basis in two-space. If you measure in the wrong basis, you get random results and disturbs future measurements.
|
- A photon has a polarization that can be measured on any basis in a two‑dimensional space. If you measure in the wrong basis, you get random results and disturbs future measurements.
|
||||||
- Alice sends Bob a stream of photons. Each photon is randomly assigned a polarization in for direction (-1, 0, 1, 0).
|
- Alice sends Bob a stream of photons. Each photon is randomly assigned a polarization in for direction (-1, 0, 1, 0).
|
||||||
- Bob randomly picks a basis for each photon. Every time he chooses the right basis, he measure the polarization correctly, otherwise, he gets random.
|
- Bob randomly picks a basis for each photon. Every time he chooses the right basis, he measure the polarization correctly, otherwise, he gets random.
|
||||||
- Now Bob contact Alice in clear and tells the basis settings he made. Alice tells him which were correct. The others were thrown out.
|
- Now Bob contact Alice in clear and tells the basis settings he made. Alice tells him which were correct. The others were thrown out.
|
||||||
|
|
@ -450,15 +469,17 @@ replace the known IV with a secret shared key.
|
||||||
- To detect eavesdropping, Alice and Bob agree to check on some of the bits, which are randomly chosen by Alice.
|
- To detect eavesdropping, Alice and Bob agree to check on some of the bits, which are randomly chosen by Alice.
|
||||||
- Eve can perform a MITM attack and impersonate Alice and Bob for each other, so QC needs some authentication.
|
- Eve can perform a MITM attack and impersonate Alice and Bob for each other, so QC needs some authentication.
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
* **CryptoAnalysis**: there are three types:
|
* **CryptoAnalysis**: there are three types:
|
||||||
- **Ciphertext only attack**: enemy intercepted ciphertext but has no matching plaintext. The enemy is aware of the nature of the cryptosystem but does not have the key, or the enemy is not aware of the nature of the cryptosystem (not stable).
|
- **Ciphertext only attack**: enemy intercepted ciphertext but has no matching plaintext. The enemy is aware of the nature of the cryptosystem but does not have the key, or the enemy is not aware of the nature of the cryptosystem (not stable).
|
||||||
- **Known plaintext attack**: enemy has some matched ciphertext/plaintext pairs.
|
- **Known plaintext attack**: enemy has some matched ciphertext/plaintext pairs.
|
||||||
- **Chosen plaintext attack**: the enemy can choose the plaintext that she wants to put through the system.
|
- **Chosen plaintext attack**: the enemy can choose the plaintext that she wants to put through the system.
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
- [Crypto Intro](http://math.scu.edu/~eschaefe/book.pdf)
|
- [Crypto Intro](http://math.scu.edu/~eschaefe/book.pdf)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue