diff --git a/Cryptography/README.md b/Cryptography/README.md index c9b0b49..1cab09e 100644 --- a/Cryptography/README.md +++ b/Cryptography/README.md @@ -8,7 +8,7 @@ - hints about keys and signing --> likely RSA. - +--- ## MD5 @@ -106,7 +106,11 @@ In Python [we can use decoding](https://docs.python.org/2/library/codecs.html#co ### Readings: -- [How Viginere works](http://sharkysoft.com/vigenere/). +- [How Vigenere works](http://sharkysoft.com/vigenere/). + + + + --- @@ -263,6 +267,9 @@ $ ./openssl s_client --no_tls1 --no_ssl3 --connect :443 * For Identification and verification of encoding supported by the Website we can use **EcoScan34**. + + + --- ## Block Cipher Encryption @@ -308,3 +315,153 @@ $ ./openssl s_client --no_tls1 --no_ssl3 --connect :443 [namechk]: http://namechk.com [QR Code]: http://en.wikipedia.org/wiki/QR_code + + +## Cryptography Glossary + +* **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. + +* **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. + 2. ** cipherblock 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. + 4. **output feedback** (OFB): a way to create a keystream for a stream cipher. + +* **The Data Encryption Standard (DES)**: introduced in 1975. It uses a 56 bit key with 8 additional bits for parity check. It operates on blocks of 64 bit plaintexts and gives 64 bit ciphertext. It alternates 16 substitutions with 15 transpositions. In 1997 DES was brute-forced in 24 hours. + +* **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. + +* **Synchronous stream cipher**: when you simply XOR the plaintext with the keystream to get the ciphertext. + +* **RC4**: the most widely used stream cipher, invented in 1987: + 1. Chose n, a positive integer, say n=8. + 2. Let l = (length in bits)/n + 3. There is a key array K_0...K_{2^n -1} whose entries are n-bit strings (integers from 0 to 2^n -1). You enter the key into that array and then repeat the key as necessary. + 4. The algorithm consists of permuting the integers from 0 2^n -1. + +* **Initialization Vector**: is a dummy block used to start a block cipher. It's necessary to force the cipher to produce a unique stream of output. It doesn't need to be kept private but it must be different for every new cipher initialization with the same key. + +* **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: + 1. Agree on a key for a symmetric cryptosystem. + 2. Digital signatures. + 3. Rarely used for message exchange since it is slower than symmetric key cryptosystems. + +* **Standard key exchange protocol**: RSA, Diffie-Hellman, El Gamal. + +* **Cryptographic signature**: associating a message digest with a specific public key by encrypting the message digest with the sender's public and private key. + +* **RSA**: Recall that if gcd(m,n)=1 and a = 1(mod f(n)), then m^a = m (mod n). + 1. Bob picks p, q primes around 1e150. + 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. + 4. He publishes (n,e) and keep d, p, q hidden. + 5. Alice wants to send Bob the plaintext M (maybe an AES key) enconded as a number 0<=M