Lecture 2 - Symmetric & Asymmetric Cryptography
Lecture 2 - Symmetric & Asymmetric Cryptography
Cryptosystem
Some Basic Terminology
• plaintext - original message
• ciphertext - coded message
• cipher - algorithm for transforming plaintext to ciphertext
• key - info used in cipher known only to sender/receiver
• encipher (encrypt) - converting plaintext to ciphertext
• decipher (decrypt) - recovering plaintext from ciphertext
• cryptography - study of encryption principles/methods
• cryptanalysis (codebreaking) - study of principles/ methods of
deciphering ciphertext without knowing key
• cryptology - field of both cryptography and cryptanalysis
Symmetric Cipher Model
Requirements
• To requirements for secure use of symmetric encryption:
• a strong encryption algorithm
• a secret key known only to sender / receiver
• mathematically have:
Y = E(K, X)
X = D(K, Y)
• assume encryption algorithm is known
• implies a secure channel to distribute key
Cryptography
Can characterize cryptographic system by:
• Type of encryption operations used
• substitution
• transposition
• product
• Number of keys used
• single-key or private
• two-key or public
• way in which plaintext is processed
• block
• stream
Cryptanalysis
• objective to recover key not just message
• general approaches:
• cryptanalytic attack
• brute-force attack
• if either succeed all key use compromised
Encryption Terms
⮚ unconditional security
● no matter how much computer power or time is available, the
cipher cannot be broken since the ciphertext provides
insufficient information to uniquely determine the
corresponding plaintext
⮚ computational security
● given limited computing resources (eg time needed for
calculations is greater than age of universe), the cipher
cannot be broken
Brute Force Search
► always possible to simply try every key
► most basic attack, proportional to key size
► assume either know / recognize plaintext
Key Size (bits) Number of Alternative Time required at 1 Time required at 106
Keys decryption/µs decryptions/µs
32 232 = 4.3 × 109 231 µs = 35.8 minutes 2.15 milliseconds
56 256 = 7.2 × 1016 255 µs = 1142 years 10.01 hours
128 2128 = 3.4 × 1038 2127 µs = 5.4 × 1024 years 5.4 × 1018 years
168 2168 = 3.7 × 1050 2167 µs = 5.9 × 1036 years 5.9 × 1030 years
26 characters 26! = 4 × 1026 2 × 1026 µs = 6.4 × 1012 years 6.4 × 106 years
(permutation)
Classical Substitution Ciphers
► Where letters of plaintext are replaced by other letters
or by numbers or symbols
► Or if plaintext is viewed as a sequence of bits, then
substitution involves replacing plaintext bit patterns
with ciphertext bit patterns
► plain text characters are replaced with other
characters, numbers and symbols as well as in
substitution Cipher Technique, character’s identity is
changed while its position remains unchanged.
Classical Transposition Ciphers
► Technique rearranges the position of the plain text’s
characters.
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Block vs Stream Ciphers
► block ciphers process messages in blocks, each of which is then
en/decrypted
► like a substitution on very big characters
► 64-bits or more
► stream ciphers process messages a bit or byte at a time when
en/decrypting
► many current ciphers are block ciphers
► better analysed
► broader range of applications
Block vs Stream Ciphers
Block Cipher Principles
⮚ block size
⮚ key size
⮚ number of rounds
⮚ subkey generation algorithm
⮚ round function
⮚ fast software en/decryption
⮚ ease of analysis
Data Encryption Standard (DES)
► public-key/two-key/asymmetric
cryptography involves the use of two keys:
► a public-key, which may be known by anybody,
and can be used to encrypt messages, and
verify signatures
► a related private-key, known only to the
recipient, used to decrypt messages, and sign
(create) signatures
► infeasible to determine private key from
public
► is asymmetric because
► those who encrypt messages or verify signatures
cannot decrypt messages or create signatures
Public-Key Cryptography
Public-Key Cryptography…
Conventional and Public-Key Encryption
Public-Key Cryptosystem: Secrecy
Public-Key Cryptosystem: Authentication
Public-Key Cryptosystem : Authentication and
Secrecy
Public-Key Applications
712657787088003462042414252127656101329447684093588414795351507176463595017227211072970118841762091485375709799542405462152560279704449496220875560157388
117857017106951260533934394968488825754114064349823293869738163117013385530132755261840984711025345525941897156084900461928551937940530567038846534744251
27
RSA En/decryption
►to encrypt a message M the sender:
►obtains public key of recipient PU={e,n}
►computes: C = Me mod n, where 0≤M<n
►to decrypt the ciphertext C the owner:
►uses their private key PR={d,n}
►computes: M = Cd mod n
►note that the message M must be smaller than the modulus n (block if needed)
RSA Key Setup
►each user generates a public/private key pair by:
►selecting two large primes at random: p, q
►computing their system modulus n=p.q
►note ø(n)=(p-1)(q-1)
►selecting at random the encryption key e
►where 1<e<ø(n), gcd(e,ø(n))=1
►solve following equation to find decryption key d
►e.d=1 mod ø(n) and 0≤d≤n
►publish their public encryption key: PU={e,n}
►keep secret private decryption key: PR={d,n}
Why RSA Works
►because of Euler's Theorem:
►aø(n)mod n = 1 where gcd(a,n)=1
►in RSA have:
►n=p.q
►ø(n)=(p-1)(q-1)
►carefully chose e & d to be inverses mod ø(n)
►hence e.d=1+k.ø(n) for some k
►hence :
Cd = Me.d = M1+k.ø(n) = M1.(Mø(n))k
= M1.(1)k = M1 = M mod n
RSA Example - Key Setup