chapter 3 : cryptography
chapter 3 : cryptography
• What is cryptography?
IT 360 • Symmetric cryptography
Chapter 2 – Brief crypto history
– Stream cipher
– Block cipher
– Hash functions
Cryptology
Alice Messag Bob
e
Cryptography Cryptanalysis
Messag Messag
Plain text
• Cryptographyis the science of secret writing for the purpose of
e e
Cryptography 3 Cryptography 4
Cryptography at a glance What can cryptography be used for?
5 6
7 8
Cryptography| the algebraic prespective
• “Secret key” means that the key is shared In secret between all entities authorized to encrypt/decrypt. → BC A.D→1799 1800→1939 1940→1975 1976→2000 2001→
Cryptography
Cryptography 9 10
Caesar Cryptosystem
Caesar chi
Cryptography 16
Claude Shannon (1916 – 2001) One-Time Pad: One-Time Pad (Gilbert Vernam, 1917)
Father of Information Theory – MIT / Bell Labs
Alice Bob
shared secret shared secret
disposable key K disposable key K
• Information theory
k1, k2, k3... kin… k1, k2, k3... kin…
– Defined "binary digit" (bit) as the smallest unit
of information Message Message
– Model for secret secure systems Plain text - XOR addition message XOR addition Plaintext
M
– Defined perfect secrecy security
message M
Cryptography 19 Cryptography 20
The perfect cipher machine: One-Time-Pad Does a perfect secure system exist?
Yes, Perfect encryption scheme can exist only if the secret information k
is as long as the plaintex t [Claude Shannon, 1943]
Time Pad
Key as long as message
Key must be absolutely random keys Key must never be
re-used
guarantees perfetc security y Key Key management
very hard
Computer generated random number sequences are
• Telex with OTP on punched tape, produced by STK on Økern lly) not good Enough
- Finding the key by cryptanalysis can exploit statistical irregularities in the cipher text.
- To prevent cryptanalysis, the bit patterns / characters in the ciphertext should have a uniform/even
distribution, that is, all bit patterns / characters should be equally likely.
24
Block cipher
Shannon's SP network (1949)
Erases statistical irregularities Plaintext block (typically 128 bits)
...
E
.
• Permutation
– Sub-blocks are moved around the block. S S .... S
Roundn
– Provides “diffusion”, i.e. that changing a .P
single plaintext bit (or key bit) causes
many ciphertext bits to change.
•The key is included in S or P or in a separate
function Ciphertext block (typically 128 bits)
Cryptography 26
AES - Advanced Encryption Standard
Block cipher and stream cipher
• DES (Data Encryption Standard) from 1977 had a 56-bit key and a
64-bit block. In the mid-1990s, DES could be cracked with full key Block cipher Stream cipher
search.
Block with
• In 1997, NIST announced an open competition to design a new plain text Key
block cipher to replace DES. n bits
• The best proposal called "Rijndael" (designed by Vincent Rijmen and Joan
Key-
Daemen from Belgium) was considered the best, and nominated to become current-
Block-
AES (Advanced Encryption Standard) in 2001. cipher
generator
• AES has key sizes of 128, 192 or 256 bits and Key Key current
Cryptography 35 Cryptography 36
Block Cipher: Modes of Operation Electronic Code Book (ECB)
• Simplest encryption mode
• The plain text is divided into blocksM1, M2, …, Mn
• A block cipher encrypts a block of (typically) 128 bits, which is
only about 16 letters. • Each block is encrypted separately.
– Notation encryption: C1=
• For encryption of more than one block, a specific mode is used. – Notation decryption: E(M1,K)
• The encryption modes have different properties. 1=
Mciphertext
- Equal plaintext blocks give equal blocks, this is the problem!
D(C1,K)
• Common modes are: C3
M1 M2 M3 C1 C2
– CounTeRFashion (CTR) K K K K K K
– CipherBlockChaining (CBC)
secur E D D D
– OoutputFoathBack (OFB) e
E E
– CipherFoathBack (CFB)
C1 C2 C3 M1 M2 M3
– EelectronicCdesolateBalso (ECB) unsure Encryption Decryption
Cryptography 37 Cryptography 38
T1 T2 T3 T1 T2 T3
K K K K K K
E E E E E E
Plain text Ciphertext with ECB mode Cipher text with secure mode
M1 - M2 - M3 - C1 - C2 - C3 -
C1 C2 C3 M1 M2 M3
Encryption Decryption
Cryptography 39 Cryptography 40
CTR encryption and binary addition with XOR
• The plain text is divided into blocks:M1, M2, …, M n
• Incrementing counter values with the same block size:T1, T2, …, Tn
• The counter values are encrypted and added to the plaintext blocks:
– Notation encryption: C1= E(T1,K)-M1
HASH FUNCTIONS AND
– Notation decryption: M1= E(T1,K)-C1 = E(T1,K)-E(T1,K)-M1 MESSAGE AUTHENTICATION
– The encryption functionEused for both encryption and decryption
41 24
Cryptography
Hash functions
Requirements for a hash functionHash: Properties of hash functions
1.Easy to calculate: Given input datax, it should be easy to calculateHash(x).
x Arbitrarily large x ? x ? x x'
2. Compression: Compresses arbitrarily largexto a hash valueHash(x)
with fixed sizen(typically 256 bits or 512 bits).
3. One way: Given hash valuey, it should be practically impossible to find
input dataxso thatHash(x)=y.
Hash(x) Hash(x) Hash(x) Hash(x) Hash(x)
4. Collision resistance (weak): Given input dataxand associated hash value
Hash(x),it should be practically impossible to find another data setx'so
Easy to Compression one-way Weak Strong
thatHash(x)=Hash(x')(weak collision resistance). to fixed size function collision
calculate collision
5. Collision resistance (strong): It should be practically impossible to find two resistance resistance
different data setsxandx'so thatHash(x)=Hash(x')(strong collision resistance).
Cryptography 43 Cryptography 44
Well known hash functions Applications of hash functions
• MD5(1991): 128-bit hash value. Easy to find collisions, due to small hash • Comparison of files
size and poor design. Should no longer be used.
• Password protection
• SHA-1(Secure Hash Algorithm):160 bit hash value. Designed by NSA in 1995. • Integrity check
Relatively easy to find collisions. Should no longer be used, but occurs in still
older applications. • Generation of Message Authentication Codes (MAC)
• Digital signatures
• SHA-2designed by NSA in 2001. Can generate 256, 384 and 512 bit hash value.
Considered safe. Replacement for SHA-1. • Bitcoin and cryptocurrency
• Generation of pseudorandom numbers
• SHA-3:designed by Joan Daemen + others in 2010. Standardized in 2015. Can • Generation of crypto keys
generate: 256, 384, and 512 bit hash value. SHA-3 has little use, because SHA-2
is still considered secure.
Cryptography 45 Cryptography 46
ASYMMETRICAL
Bob's public
CRYPTOGRAPHY key pub
Bob's private
key
private
Plain textM
• Diffie-Hellman key exchange
• Asymmetric encryption and decryption require heavy computation, and
• Digital signature
are not used for direct encryption as shown above.
• In practice, hybrid encryption is used which combines both an
asymmetric and a symmetric algorithm.
Cryptography 49 Cryptography 50
Cryptography 51
Hybrid encryption
Hybrid encryption
• Symmetric ciphers are much faster than asymmetric ciphers (because Alice Bob
PKI
symmetric ciphers have simple mathematical computation), but ...
• Asymmetric ciphers simplify key distribution, therefore… Bob's public Bob's private
• Practical to use a combination of both symmetric and Store secret key key private
Cryptography 58
• Solution
[mod ] Bob sends to Alice
- Combination with digital signature provides authenticated key exchange
Alice secretly calculates = ( ) towards Bob secretly calculates = ( ) towards
• Applications:
Alice and Bob have exchanged anonymous secret key – TLS (Transport Layer Security) and https
– IKE (Internet Key Exchange) and IPSec (IP Security)
Attackers cannot find the secret subkeysaandbbecause calculating the
discrete logarithm of large integers is difficult. Thus, attackers cannot
calculate the secret key =gabmodp.
Cryptography 59 Cryptography 60
Digital signature: Basic principle
Need for digital signature PKI
Alice's private
• A MAC cannot be used as proof of data authenticity to be key Digital Send message as Alice's public
verified by a third party
private
S digital signatureS key
signing pub
• Digital signatures can be validated by third parties Calculate digitally Validate Calculate message
signatureS signature
– Provides strong (non-repudiable) data authentication, = Val( , pub)
= Sig(
• Features for digital signature:
private)
,
– Signing (using private key) Receive
Get ready
– Validation (uses public key) Alice MessageM
MessageM
Bob
• Digital signing and validation require heavy calculation, and are not used for direct signing
as shown above.
•In practice, hybrid signing is used which combines a hash function and digital signing.
Cryptography 38 Cryptography 62
Cryptography 63 Cryptography 64
Quantum computers
• Quantum computing (Quantum Computing - QC) is based on
quantum "qubits" instead of binary bits
POSTQUANTUM
CRYPTOGRAPHY Experimental
quantum computer
Symmetrical Symmetrical
encryption Confidentiality encryption Confidentiality
Hash- Hash-
functions functions
10,000,000
?
Collapse
1,000,000
No
collapse
Logarithmic scale
10,000
2016 2017 2018 2019 2020 2021 2022 2023 2024
?
50 qubits
1000
• The term "post-quantum crypto" (Post-Quantum Crypto) means computer
END OF THE
PRESENTATION
48 50
Refrence