Unit 2 - CS
Unit 2 - CS
Contents:
Cryptographic basics, transposition cipher, substitution cipher,
Block and Stream cipher, Steganography,
Public v/s private key encryption,
Private key encryption: DES,
Public key encryption: RSA,
Key management, Key exchange – Diffie-Hellman
Digital Signature, One way hash functions
Slide #1-1
General idea of symmetric-key cipher
Slide #1-2
Substitution Ciphers
• A substitution cipher replaces one symbol with another.
• Substitution ciphers can be categorized as either
monoalphabetic ciphers or polyalphabetic ciphers.
Slide #1-3
Monoalphabetic Substitution
Ciphers
Slide #1-4
Examples
Example 1
The following shows a plaintext and its corresponding ciphertext.
The cipher is probably monoalphabetic because both l’s (els) are
encrypted as O’s.
Example 2
The following shows a plaintext and its corresponding ciphertext.
The cipher is not monoalphabetic because each l (el) is encrypted
by a different character.
Note
3.8
Example 3.4
Use the additive cipher with key = 15 to decrypt the message
“WTAAD”.
Solution
We apply the decryption algorithm to the plaintext character by
character:
3.9
Shift Cipher and Caesar Cipher
Historically, additive ciphers are called shift ciphers. Julius
Caesar used an additive cipher to communicate with his officers.
For this reason, additive ciphers are sometimes referred to as the
Caesar cipher. Caesar used a key of 3 for his communications.
Note
3.11
Polyalphabetic Ciphers
Autokey Cipher
Auto Key Cipher
Assume that Alice and Bob agreed to use an autokey cipher with
initial key value k1 = 12. Now Alice wants to send Bob the message
“Attack is today”. Enciphering is done character by character.
3.20
Playfair Cipher
3.21
Vigenere Cipher
3.22
Let us see how we can encrypt the message “She is listening” using
the 6-character keyword “PASCAL”. The initial key stream is (15,
0, 18, 2, 0, 11). The key stream is the repetition of this initial key
stream (as many times as needed).
3.23
TRANSPOSITION CIPHERS
A transposition cipher does not substitute one symbol for another,
instead it changes the location of the symbols.
Note
Alice and Bob can agree on the number of columns and use the
second method. Alice writes the same plaintext, row by row, in a
table of four columns.
3.27
3.3.2 Continued
Example 3.25
3.28
Combining Two Approaches
3.29
Double Transposition Ciphers
3.30
DES( Data Encryption
Standard)
History
In 1973, NIST published a request for proposals for a national
symmetric-key cryptosystem.
A proposal from IBM, a modification of a project called Lucifer, was
accepted as DES. DES was published in the Federal Register in March
1975 as a draft of the Federal Information Processing Standard (FIPS).
Slide #1-31
Overview
6.33
Rounds
A round in DES
(encryption site)
DES Function
DES function
Expansion P-box
Since RI−1 is a 32-bit input and KI is a 48-bit key, we first
need to expand RI−1 to 48 bits.
Expansion permutation
6.38
Although the relationship between the input and output
can be defined mathematically, DES uses to define this P-
box.
Expansion P-box table
6.39
Continue
Whitener (XOR)
After the expansion permutation, DES uses the XOR
operation on the expanded right section and the round
key. Note that both the right section and the key are 48-
bits in length. Also note that the round key is used only in
this operation.
6.40
Continue
S-Boxes
The S-boxes do the real mixing (confusion). DES uses 8
S-boxes, each with a 6-bit input and a 4-bit output.
S-boxes
6.41
Continue
S-box rule
6.42
Continue
Table shows the permutation for S-box 1. For the rest of
the boxes see the textbook.
S-box 1
6.43
Continued
Solution
If we write the first and the sixth bits together, we get 11 in
binary, which is 3 in decimal. The remaining bits are 0001 in
binary, which is 1 in decimal. We look for the value in row 3,
column 1, in Table 6.3 (S-box 1). The result is 12 in decimal,
which in binary is 1100. So the input 100011 yields the output
1100.
6.44
Continued
Solution
If we write the first and the sixth bits together, we get 00 in
binary, which is 0 in decimal. The remaining bits are 0000 in
binary, which is 0 in decimal. We look for the value in row 0,
column 0, in Table 6.10 (S-box 8). The result is 13 in decimal,
which is 1101 in binary. So the input 000000 yields the output
1101.
6.45
Continue
Straight Permutation
6.46
Key generation
6.47
Key-compression table
Modular Arithmetic
The (mod n) operator maps all integers into the set of integers {0,1,
... (n 1)}.
PROPERTIES
1. [(a mod n) + (b mod n)] mod n = (a + b) mod n
2. [(a mod n) x (b mod n)] mod n = (a X b) mod n
Slide #1-49
Why Public Key
Cryptography?
developed to address two key issues:
key distribution – how to have secure
communications in general without having to
trust a KDC with your key
digital signatures – how to verify a message
Slide #1-60
Key Distribution
symmetric schemes require both parties to share a
common secret key
Issue is how to securely distribute this key while
protecting it from others
Frequent key changes can be desirable
Often secure system failure due to a break in the key
distribution scheme
Key Distribution
Given parties A and B have various key distribution
alternatives:
1. A can select key and physically deliver to B
2. third party can select & deliver key to A & B
3. if A & B have communicated previously can use
previous key to encrypt a new key
4. if A & B have secure communications with a
third party C, C can relay key between A & B
Key Hierarchy
Typically have a hierarchy of keys
Session key
Temporary key
Master key
used to encrypt session keys
64
Needham-Schroeder Shared-Key
Protocol: Use Trusted Third
Party
Parties: A, B, and trusted server T
Setup: A and T share KAT, B and T share KBT
Goal: Mutual entity authentication between A and B; key
establishment
A T: A, B, NA (1)
A T: E[KAT] (NA, B, k, E[KBT](k,A)) (2)
A B: E[KBT] (k, A) (3)
A B: E[k] (NB) (4)
A B: E[k] (NB-1) (5)
96
Hash Function
•A hash function H accepts a variable-length block of data M as input and
produces a fixed-size hash value h = H(M).
•A "good" hash function has the property that the results of applying the
function to a large set of inputs will produce outputs that are evenly distributed,
and apparently random.
•In general terms, the principal object of a hash function is data integrity.
• A change to any bit or bits in M results, with high probability, in a change to the
hash code.
•Previous Figure depicts the general operation of a cryptographic hash function.
•Typically, the input is padded out to an integer multiple of some fixed length
(e.g., 1024 bits) and the padding includes the value of the length of the original
message in bits.
Iam#4VKU Iam#4VKU
Passwor
d store
h h