Chapter Three Security
Chapter Three Security
• Given
– P=Plaintext
– C=CipherText
– k=key shared by sender and receiver
• C = EK (P) Encryption
• P = DK (C) Decryption
• Boris Hagelin of
Sweden developed a
long line of cipher
systems, beginning
with the B-21, B-211,
C-35, C-36, C-38
(which later became
America's M-209).
• It is basically a
nicely implemented
Wheatstone cipher
disk. It was in
active use in the
Danish armed
forces from 1934
(or a little earlier)
until around 1948.
Dilla University, Department of
Computer Science
History: People in Breaking Codes
• Polyalphabetic cipher
– Playfair cipher
– Hill cipher
– Vigenere cipher
Symmetric key
Original
plaintext ciphertext plaintext
Encryption Decryption
Asymmetric key
Original
plaintext ciphertext plaintext
Encryption Decryption
Dilla University,
Department of Computer
Science
Symmetric Cryptosystem
• Also called secret-key/private-key cryptosystem
• The same key is used to encrypt and decrypt a
message
– P = DK [EK (P) ]
• Have been used for centuries in a variety of forms
• The key has to be kept secret
• The key has to be communicated using a secure
channel
• They are still in use in combination with public key
cryptosystems due to some of their advantages
Dilla University,
Department of Computer
Science
Cont. …
Dilla University,
Department of Computer
Science
ECB Mode
• Notation: C=E(P,K)
• Given plaintext P0,P1,…,Pm,…
• Obvious way to use a block cipher is
Encrypt Decrypt
C0 = E(P0, K), P0 = D(C0, K),
C1 = E(P1, K), P1 = D(C1, K),
C2 = E(P2, K),… P2 = D(C2, K),…
• For a fixed key K, this is an electronic
version of a codebook cipher (no additive)
Dilla University,
Department of Computer
Science
ECB Cut and Paste Attack
• Suppose plaintext is
Alice digs Bob. Trudy digs Tom.
• Assuming 64-bit blocks and 8-bit ASCII:
P0 = “Alice di”, P1 = “gs Bob. ”,
P2 = “Trudy di”, P3 = “gs Tom. ”
• Ciphertext: C0,C1,C2,C3
• Trudy cuts and pastes: C0,C3,C2,C1
• Decrypts as
Alice digs Tom. Trudy digs Bob.
Dilla University,
Department of Computer
Science
ECB Weakness
• Suppose Pi = Pj
• Then Ci = Cj and Trudy knows Pi = Pj
• This gives Trudy some information, even
if she does not know Pi or Pj
• Trudy might know Pi
• Is this a serious issue?
Dilla University,
Department of Computer
Science
CBC Mode
Dilla University,
Department of Computer
Science
CBC Mode
• Identical plaintext blocks yield different
ciphertext blocks
• Cut and paste is still possible, but more
complex (and will cause garbles)
• If C1 is garbled to, say, G then
P1 C0 D(G, K), P2 G D(C2, K)
• But P3 = C2 D(C3, K), P4 = C3 D(C4, K),…
• Automatically recovers from errors!
Dilla University,
Department of Computer
Science
Counter Mode (CTR)
Dilla University,
Department of Computer
Science
Popular Example of Symmetric
Cryptosystem:DES
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. Dilla University, Department of
Computer Science
Cryptography
DES- Algorithm, the f-function
-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...”
DES- Permutation principles
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
Attack on DES
• 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.
• Major Activities
• Key Generation (Algorithm)
• Encryption
• Digital signing
• Decryption
• Signature verification
RSA- Decryption
Message: ATTACKxATxSEVEN
• Grouping the characters into blocks of three and computing a
message representative integer for each block:
ATT ACK XAT XSE VEN
• In the same way that a decimal number can be represented as the
sum of powers of ten, e.g. 135 = 1 x 102 + 3 x 101 + 5, we could
represent our blocks of three characters in base 26 using A=0,
B=1, C=2, ..., Z=25
• ATT = 0 x 262 + 19 x 261 + 19 = 513
ACK = 0 x 262 + 2 x 261 + 10 = 62
XAT = 23 x 262 + 0 x 261 + 19 = 15567
XSE = 23 x 262 + 18 x 261 + 4 = 16020
VEN = 21 x 262 + 4 x 261 + 13 = 14313