crypto (1)
crypto (1)
Mohamed Hassan
Outline
Understanding cryptography components
Symmetric Encryption
Asymmetric (Public) Encryption
Block cipher and stream cipher
Hashing
GNU Privacy Guard (GPG)
Cryptography I
Cryptography is the art (and sometimes science)
of secret (crypto) writing (graphy).
Hash functions: No key (fixed length)
Secret key cryptography (Symmetric): One key
Public key cryptography (Asymmetric): Pair of keys –
public, private
Cryptography
plaintext ciphertext plaintext
Encryption Decryption
Key KA Key KB
Example
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
G O K E A N Q U Y C P T L F H W B M V X Z R I D S J
• Key = 15
• C = M+Key (mod 26)
• M = HELLO
- H [7+15 (mod26) ≈ 22] >> W
- e [4+15 (mod26) ≈ 19] >> T
-l [11+15 (mod26) ≈ 0] >> A
-l [11+15 (mod26) ≈ 0] >> A
- o [14+15 (mod26) ≈ 3] >> D
• C = WTAAD
• M = C-Key (mod 26)
Symmetric-Key Cryptography
plaintext ciphertext plaintext
Encryption Decryption
Key KA Key KB
• “Confusion” = Substitution
• a -> b
• Caesar cipher
• “Diffusion” = Transposition or Permutation (Rearrange)
• abcd -> dacb
• DES
Confusion and Diffusion (2)
• “Confusion” : a classical Substitution Cipher
• In a good block cipher, each output bit is a function of all n input bits
and all k key bits
Stream Cipher
• Stream ciphers
• Rather than divide bit stream into discrete blocks, as block ciphers
do, XOR each bit of your plaintext continuous stream with a bit
from a pseudo-random sequence
• At receiver, use same symmetric key, XOR again to extract
plaintext
Public Key Cryptography
In symmetric cryptosystem the same key is used
to encrypt and decrypt.
The idea behind public key cryptography arose
from the attempt to overcome:
1. Symmetric trust: sender and receiver
2. Key establishment/distribution: sender and
receiver need to know and agree on symmetric
key in advance.
Public Key Cryptography
Alice Bob
Encrypt M using B
e
>> Decrypt M using Bs
Storage: secret key should be kept in a safe place!
Key exchange: share and trust
Authentication:
Secret keys: need secret key for every person to
communicate with.
Hashing