Definitions
- Information security: protecting information and information systems from unauthorized access, use, disclosure, disruption, modification, or destruction.
Security Properties
-
Confidentiality:
- No improper disclosure of information. or
- No unauthorized access to information.
-
Privacy: Confidentiality of information that you don’t want to share.
-
Anonymity: Confidentiality of your identity.
-
Integrity:
- No improper modification of information. or
- No unauthorized modification of information.
-
Availability:
- No improper impairment of functionality/service. or
- No unauthorized impairment of functionality
-
Authentication: Principals or data origin can be identified accurately
-
Non-repudiation: Actions done cannot be denied
-
Accountability: Actions can be traced to responsible principals
Encryption Scheme
where
- Symmetric algorithms:
, or are easily derived from each other.
- Asymmetric algorithms:
- Public key can be published without compromising private key.
Security depends only on secrecy of the key, not on the algorithm
Mathematical Formalization
Let
Similarly, let
Let
For each
So we could represent as follows:
and
Since that the encryption function
Characteristics of Cryptographic Systems
-
Type of operations used to transform plaintext into ciphertext
- based on two general principles:
- Substitution: each element in plaintext (bit, letter) is mapped into another element.
- Transposition: elements in plaintext are rearranged
- Most systems involve multiple stage substitutions and transpositions.
- based on two general principles:
-
Number of keys used
- Symmetric, single-key, secret-key, or conventional encryption: sender and receiver use same key
- Asymmetric, two-key, public-key encryption: sender and receiver use different keys
-
Way in which plaintext is processed
- Block cipher: processes input one block of elements at a time, producing an output block for each input block.
- Stream cipher: processes input elements continuously, producing in output one element at a time, as it goes along.
Symmetric key encryption
For symmetric encryption scheme
- Also known as: secret-key, single-key, one-key, shared-key, conventional encryption.
Historical Ciphers
Caesar Cipher
where
Especially, when we set ROT13, where
Mono-alphabetic substitution ciphers
Map a element in
Homophonic substitution ciphers
Map a element in
For communicators: This relationship/set is the key
For cryptanalysis: frequency analysis is more difficult
For example:
for
The plaintext xy encrypts to one of 0001, 0011, 1001, 1011
Playfair Cipher
steps:
- Pick keyword (here: monarchy)
- Construct matrix: fill in letters of keyword (minus duplicates) left2right & top2bottom, and remaining letters in alphabetic order, where I and J count as one letter.
- Plaintext is encrypted two letters at a time:
- If a pair is a repeated letter, insert filler like ‘X’ (e.g., “BALLOON” ; “BA LX LO ON"). Add an ‘X’ also at the end, if needed (or any other character).
- If both letters fall in the same row, replace each with letter to right, wrapping back to start from end (e.g., “AR" is encrypted as “RM").
- If both letters fall in the same column, replace each with the letter below it, wrapping to top from bottom (e.g., “MU” is encrypted as “CM").
- Otherwise each letter is replaced by the letter in the same row and in the column of the other letter of the pair (e.g., “HS" becomes “BP" and “EA" becomes “IM", or “JM", as the encipherer wishes)
Vigenere Cipher (polyalphabetic substitution cipher)
- a sequence of plaintext letters
, - a key consisting of the sequence of letters
, typically .
The encryption/decryption is as follows:
and
Vernam Cipher
Rail Fence Cipher
Columnar transposition cipher
Example:
Also, we could perform another encryption to be more secure.
Feistel Cipher
Composite (product) ciphers: combining both substitution and transposition
Encryption:
Decryption:
Since
Proof:
$\begin{equation} \begin{split} LD_i & = RE_{16 - i} \\\ & = LE_{16 - i - 1} \oplus F(RE_{16 - i - 1}, K_{16 - i}) \\\ & = LE_{15 - i} \oplus F(RE_{15 - i}, K_{16 - i}) \\\ & = RD_{16 - 15 + i} \oplus F(LD_{16 - 15 + i}, K_{16 - i}) \\\ & = RD_{i + 1} \oplus F(LD_{i + 1}, K_{16 - i}) \\\ & = RD_{i + 1} \oplus F(RD_i, K_{16 - i}) \end{split} \end{equation}$
$\begin{equation} \begin{split} RD_i & = LE_{16 - i} \\\ & = RE_{16 - i - 1} \\\ & = RE_{15 - i} \\\ & = LD_{16 - 15 + i} \\\ & = LD_{i + 1} \end{split} \end{equation}$
DES Encryption
-
Block size: 64 bits
-
Key size: 56 bits (last 1 bit for each 7 bits used to validate the key itself)
-
Key validation:
-
Single Round:
-
Expansion:
-
Substitution:
-
Permutation:
-
-
Key generation:
DES Security
-
two DES encryptions:
Meet in the middle attack:
Find two keys satisfying
-
Triple DES
or For two keys in T-DES:
- Compatibility is maintained with standard DES
. - No known practical attack
- Compatibility is maintained with standard DES
S-DES
-
IP
-
-
Key generation:
Block Cipher Modes
ECB
-
Encryption:
-
Decryption:
-
Properties:
- Same encrypted block if the plaintext is same
- Could parallel process
CBC
-
Encryption:
, -
Decryption:
, -
Properties:
- need pad last block if not full
- if an error occurs (changed bits, dropped blocks) in Ci but not Ci+1, then Ci+2 is correctly decrypted.
CFB
-
Encryption:
is the most significant bits of , is the register initially contains IV, and fill with the afterwards. Every encryption shifts the
bits to refresh value. -
Decryption:
-
Properties:
- Only use encryption function
- Act like stream cipher
OFB
-
Encryption/Decryption:
-
Properties:
- Similar as CFB, except that OFB uses encrypted block to xor with text
Number Theory
-
GCD & Extended GCD
- GCD
gcd(a, b): if b == 0 then return a else return gcd(b, a mod b) - Extended GCD
exgcd(a, b): if b == 0 then return (a, 1, 0) else (d', x', y') <- exgcd(b, a mod b) return (d', y', x' - (int(a / b) * y))
- GCD
RSA
-
Primitives
We must get two factors
and of , which is hard. -
Generate keys
-
Select prime numbers
-
Calculate
and -
select
where, , relatively prime to -
Compute
-
Set public key
and private key
-
-
Encryption and Decryption
and
Asymmetric algorithms for distribution
-
Digital envelope
Using asymmetric algorithm to encrypt symmetric key, for example, RSA
Sender:
Receiver:
and then -
Key exchange algorithms
Diffie-Hellman Key Exchange
-
Discrete logarithms
, there is In other words: for any integer b and a primitive root s of prime number p, we can find a unique exponent i such that
where . -
Key exchange
- share a prime number
and an integer which is a primitive root of - A and B generate random numbers,
and for A and B, respectively - A and B computes
, where - exchange
and - compute
- share a prime number
-
Group DH exchange
- El Gamal
: : = : ,
Hash
-
Hash function:
- Maps an input with arbitrary bit length to an output of fixed bit length
- computable in limited time
-
Cryptographic hash function:
- One-way, it is hard to get
when only given - It's difficult to find
that
- One-way, it is hard to get
-
MAC (Message Authentication Code):
- Family of hash functions parameterized by secret key
- given
, it is infeasible to compute for
Security Protocols
Needham-Schroeder Public Key Protocol (NSPK)
Procedure
MITM
NSL Protocol
Procedure
MITM
,
Zero-knowledge Protocols
Principals
- Prover:
- Verifier:
- Trusted Third Party:
Setup
: choose prime numbers , , publish : choose where , and publish : knows and
Verification (Peggy knows s)
: choose where , calculate and send to : send challenge where : calculate : calculate and and check if
Proof: $\begin{equation} \begin{split} y^2 \mod n & = (r * s^c)^2 \mod n \\\ & = (r^2 * s^2c) \mod n \\\ & = (r^2 * (S^2)^c) \mod n \\\ & = (x * v^c) \mod n \end{split} \end{equation}$
Cheating
Principal
: Only knows
Cheat
-
choose : choose where , set : choose : set : check and
-
choose : choose where , set : choose : set : check and