Professional Documents
Culture Documents
Classical Encryption Techniques
Classical Encryption Techniques
Given
P=Plaintext
C=CipherText
k=key shared by sender and receiver
C = EK (P) Encryption
P = DK (C) Decryption
Cryptography
Notation:
Given
P=Plaintext
C=CipherText
k=key shared by sender and receiver
C = EK (P) Encryption
P = DK (C) Decryption
Substitution Techniques
•The two basic building blocks of all
encryption techniques are substitution and
transposition.
•A substitution technique is one in which
the letters of plaintext are replaced by other
letters or by numbers or symbols.
Cont’d
Caesar Cipher - early example:
3. Two plaintext letters that fall in the same column are each replaced
by the letter beneath, with the top element of the column circularly
following the last. For example, mu is encrypted as CM.
4. Otherwise, each plaintext letter in a pair is replaced by the letter that lies in
its own row and the column occupied by the other plaintext letter. Thus, hs
becomes BP and ea becomes IM (or JM, as the encipherer wishes).
Hill Cipher
• Another interesting multiletter cipher is the Hill
cipher, developed by the mathematician Lester Hill in
1929. The encryption algorithm takes m successive
plaintext letters and substitutes for them m ciphertext
letters. The substitution is determined by m linear
equations in which each character is assigned a
numerical value (a = 0, b = 1 ... z = 25). For m = 3, the
system can be described as follows:
Cont’d
Cont’d
Decryption of Hill Cipher
Decryption requires using the inverse of the matrix K. The
inverse K1 of a matrix K is defined by the equation KK1 = K1K
= I, where I is the matrix that is all zeros except for ones along
the main diagonal from upper left to lower right. The inverse of
a matrix does not always exist, but when it does, it satisfies the
preceding equation. In this case, the inverse is:
Polyalphabetic Ciphers
•To aid in understanding the scheme and to aid in its use, a matrix
known as the Vigenère tableau is constructed (Table 2.32). Each of the
26 ciphers is laid out horizontally, with the key letter for each cipher
to its left. A normal alphabet for the plaintext runs across the top. The
process of encryption is simple: Given a key letter x and a plaintext
letter y, the ciphertext letter is at the intersection of the row labeled x
and the column labeled y; in this case the ciphertext is V.
Cont’d
Cont’d
•
Cont’d
Types of attacks
The attacker has only the ciphertext and his
goal is to find the corresponding plaintext
The attacker has a ciphertext and the
corresponding plaintext and his goal is to
find the key
In late 1974, IBM proposed "Lucifer", which was then modified by NSA
(National Security Agency) in 1976 to become the DES (Data Encryption
Standard). DES was approved by the NBS in 1978. The DES was
standardized by the ANSI under the name of ANSI X3.92, also known as
DEA (Data Encryption Algorithm).
Cryptography
DES- Example of Symmetric Cryptosystem …
DES Utilizes block cipher, which means that during the
encryption process, the plaintext is broken into fixed length blocks
of 64 bits.
The key is 56 bits wide. 8-bit out of the total 64-bit block key is
used for parity check (for example, each byte has an odd number
of bits set to 1).
56-bit key gives 256 ( 7.2*1016) possible key variations
If S1 is the function defined in this table and B is a block of 6 bits, then S1(B) is determined as
follows: The first and last bits of B represent in base 2 a number in the decimal range 0 to 3 (or
binary 00 to 11). Let that number be i. The middle 4 bits of B represent in base 2 a number in the
decimal range 0 to 15 (binary 0000 to 1111). Let that number be j. Look up in the table the number in
the i-th row and j-th column. It is a number in the range 0 to 15 and is uniquely represented by a 4
bit block. That block is the output S1(B) of S1 for the input B. For example, for input block B =
011011 the first bit is "0" and the last bit "1" giving 01 as the row. This is row 1. The middle four bits
are "1101". This is the binary equivalent of decimal 13, so the column is column number 13. In row
1, column 13 appears 5. This determines the output; 5 is binary 0101, so that the output is 0101.
Hence S1(011011) = 0101.
Cryptography
DES- Algorithm, the f-function
Cryptography
DES- Generating Subkey
To generate the subkeys, start with the 56-bit key (64 bits if
you include the parity bits). These are permuted and
divided into two halves called C and D.
For each round, C and D are each shifted left circularly one
or two bits (the number of bits depending on the round).
The 48-bit subkey is then selected from the current C and D
bits.
Cryptography
-1
IP IP
58 50 42 34 26 18 10 2 40 8 48 16 56 24 64 32
60 52 44 36 28 20 12 4 39 7 47 15 55 23 63 31
62 54 46 38 30 22 14 6 38 6 46 14 54 22 62 30
64 56 48 40 32 24 16 8 37 5 45 13 53 21 61 29
57 49 41 33 25 17 9 1 36 4 44 12 52 20 60 28
59 51 43 35 27 19 11 3 35 3 43 11 51 19 59 27
61 53 45 37 29 21 13 5 34 2 42 10 50 18 58 26
63 55 47 39 31 23 15 7 33 1 41 9 49 17 57 25
“First Bit of the output is taken from the 58th bit of the input, etc...”
Cryptography
DES- Permutation principles
Expansion/Permutation Contraction/Permuted Choice (PC-2)
The 32-bit half-block of data is expanded Selects/Extracts the 48-bit subkey for each
to 48 bits. round from the 56-bit key-schedule state.
E PC-2
32 1 2 3 4 5 14 17 11 24 1 5
4 5 6 7 8 9 3 28 15 6 21 10
8 9 10 11 12 13 23 19 12 4 26 8
12 13 14 15 16 17 16 7 27 20 13 2
16 17 18 19 20 21 41 52 31 37 47 55
20 21 22 23 24 25 30 40 51 45 33 48
24 25 26 27 28 29 44 49 39 56 34 53
28 29 30 31 32 1 46 42 50 36 29 32
DES- Algorithm, General depiction (W. Stallings)
Cryptography
Cryptography
DES- Single round of DES Algorithm (W. Stallings)
Cryptography
DES- Example of Symmetric Cryptosystem …
Cracking: The most basic method of attack for any cypher is
brute force - trying every possible key in turn.
The length of the key determines the number of possible
keys, and hence the feasibility of the approach.
DES is not adequate with this regard due to its key size
In academia, various proposals for a DES-cracking machine
were advanced.
In 1977, Diffie and Hellman proposed a machine costing an
estimated US$20 million which could find a DES key in a single day.
By 1993, Wiener had proposed a key-search machine costing US$1
million which would find a key within 7 hours.
However, none of these early proposals were ever
implemented.
Cryptography
DES- Example of Symmetric Cryptosystem …
Setting K3 equal to K1 in these processes gives us a double length key K1, K2.
Setting K1, K2 and K3 all equal to K has the same effect as using a single-length
(56-bit key).
Thus it is possible for a system using triple-DES to be compatible with a system
using single-DES.
Cryptography
Click for
DES Preliminary
Examples
Cryptography
Asymmetric/Public key/ Cryptosystem
Also called public-key cryptosystem
keys for encryption and decryption are different but form a unique pair
P = DKD [EKE (P) ]
Only one of the keys need to be private while the other can be public
Invented by Diffie and Hellman in 1976
Summary
A pair of keys (private, public)
If you have the private key, you can easily
decrypt what is encrypted by the public key
Otherwise, it is computationally infeasible to
decrypt what has been encrypted by the
public key
Cryptography
Hash functions
Major Activities
Key Generation (Algorithm)
Encryption
Digital signing
Decryption
Signature verification
Cryptography
RSA- Key Generating Algorithm
1. Choose/generate two distinct prime numbers p and q.
2. Compute n = pq.
3. Compute φ(n) = (p – 1)(q – 1), where φ is Euler's totient function.
4. Choose an integer e such that 1 < e < φ(n) and gcd(e, φ(n)) = 1,
(coprimes).
5. Determine d = e–1 mod φ(n); i.e. d is the multiplicative inverse of e
mod φ(n). This is often computed using the extended Euclidean
algorithm.
Result:
Keep all the values d, p, q and φ secret
n is known as the modulus for both the public and private keys
e is known as the public key exponent or encryption exponent
d is known as the private key exponent or decryption exponent.
Cryptography
RSA- Encryption
Sender A does the following
Obtains the recipient B's public key (n, e)
Represents the plaintext message as a positive integer m
Computes the cipher-text c = me mod n
Sends the cipher-text c to B
RSA- Decryption
Recipient B does the following
Uses his private key (n, d) to compute m = cd mod n
Extracts the plaintext from the message representative m
Cryptography
RSA- Key Generation Simple Example
1. Select primes p=11, q=3.
2. n = pq = 11*3 = 33
phi = (p-1)(q-1) = 10*2 = 20
3. Choose e=3
Check gcd(e, p-1) = gcd(3, 10) = 1 (i.e. 3 and 10 are relatively prime -
have no common factors except 1) and check gcd(e, q-1) = gcd(3, 2) = 1,
therefore gcd(e, phi) = gcd(e, (p-1)(q-1)) = gcd(3, 20) = 1
4. Compute d (1<d<phi) such that d = e-1 mod phi = 3-1 mod 20
i.e. find a value for d such that phi divides ed-1 (20 divides 3d-1.)
Simple testing (d = 2, 3 ...) gives d = 7
Check: ed-1 = 3*7 - 1 = 20, which is divisible by phi (20).
5. Public key = (n, e) = (33, 3)
Private key = (n, d) = (33, 7).
Cryptography
Given: Public key = (n, e) = (33, 3)
Private key = (n, d) = (33, 7)
How do we encrypt and decrypt?
Signature Verification
Recipient B does the following
Uses sender A's public key (n, e) to compute integer v = se mod n
Extracts the message digest from this integer
Independently computes the message digest of the information that has
been signed
If both message digests are identical, the signature is valid
Cryptography
Key Distribution: Verifying Someone’s Public Key
Even with public-key cryptosystems and digital
signatures, we still have the problem of authentication:
binding users to keys.
Early days articles envisioned phonebook-like database
with Name and Public Key entries.
Attacker can put in his own key for someone else, and
start signing fake contracts (and even checks!).
Maybe we can secure the phonebook, but then it kills the
idea of keys widely and easily available (publicly) .
Cryptography
Key Distribution: Problems
Digital money
Protection against fraud
It should not be possible to use the money more than once
It should not be possible to use forged money