# ENCRYPTION

.

1

Presented by
Naveed I. Salman MS(CS)

2

Encryption
• A message sent over a network can be read by any site between the source and the destination (e.g. each hop in email). • Encryption is the process of encoding a message so that it is decipherable only by its intended recipient (anyone intercepting the message would be unable to interpret it)
3

Encryption
• • • • The sender encrypts the message The sender transmits the message to the receiver The receiver decodes the message How does the receiver decode the message? The sender needs to send the key to the receiver. BUT, now this can be intercepted.
4

Encryption
• Cryptography - study of methods to encrypt text. • Cryptanalysis - study of how to decode an encypted text. • Strong Encryption - infeasible to crack • Weak Encryption - can be cracked

5

Example
• Substitution cipher - each letter of the alphabet is substituted with a different letter or symbol. • Ceasar's method - replace every letter in the alphabet with the letter 3 places after it
–A->D –B->E … –Y->B –Z->C
6

The Caesar Cipher
• Julius Caesar used this to encrypt messages • A function f to encrypt a letter is defined as: f(p) = (p+3) mod 26
– Where p is a letter (0 is A, 1 is B, 25 is Z, etc.)

• Decryption: f-1(p) = (p-3) mod 26 • This is called a substitution cipher
– You are substituting one letter with another
7

The Caesar Cipher
• The Caesar cipher is a substitution cipher, named after Julius Caesar. • Operation principle: each letter is translated into the letter a fixed number of positions after it in the alphabet table. • The fixed number of positions is a key both for encryption and decryption.
8

The Caesar Cipher (cnt’d)
K=3
Outer: plaintext Inner: ciphertext

9

An Example
• For a key K=3, plaintext letter: ABCDEF...UVWXYZ ciphtertext letter: DEF...UVWXYZABC • Hence TREATY IMPOSSIBLE is translated into WUHDWB LPSRVVLEOH

10

Breaking Classic Ciphers
• With the help of fast computers, 99.99% ciphers used before 1976 are breakable • Modern cluster computers and future quantum computers can break several existing ciphers due to the power of such computers.

11

Breaking the Classic Cipher
• By trial-and error • By using statistics on letters
– frequency distributions of letters letter percent A 7.49% B 1.29% C 3.54% D 3.62% E 14.00% ..................................
12

An Example of Private Key Cryptography
• • • Assume that a message is broken into 64-bit blocks and each 64bit block of plaintext is encrypted separately: Assume that all 8 bits of a byte is used and key digits start from left to right. Encryption: Each plaintext block is first shifted by the number of binary digits before the last non-zero digit of the key. It is then exclusive-ored with the key starting from the first byte of the block, repeatedly to the end of the block (the key moves a distance of its size from left to right of the plaintext block). Decryption: do the reverse of encryption: the cipher-text is exclusive-ored and then shifted. 0 1 0 1 0 1 1 0 = = = = 0 0 1 1
: exclusive or
13

Principles of Private Key Encryption
• Devise cryptographic algorithms:
– a set of fast functions (E1, E2, E3, ..En) that when in turn applied to an input (initial or intermediate input) will produce a more potentially scrambled output. – and a set of functions (D1,D2,D3, .. Dn) that when in turn applied to the cipher text (final or intermediate) will produce the original input text.

Devise algorithms, tests and proofs to validate your cryptographic algorithms
– Analysing algorithms. – Tests with powerful computers such as specialised, parallel, cluster, or quantum computers. – Mathematical proofs.
14

Example of Public Key Cryptography
• Definition: The multiplicative inverse of x with modulo n is y such that (x*y) mod n = 1 E.g:x=3; n=10, => y=7; since (3*7) mod 10 = 1

The above multiplicative inverse can be used to create a simple public key cipher: either x or y can be thought of as a secret key and the other is the public key. Let x = 3, y = 7, n = 10, and M be the message: – M=4;
• 3*4 mod 10 = 2; (ciphertext) - encrypting • 2*7 mod 10 = 4 = M ; (message) - decrypting

– M =6 ;
• 3*6 mod 10 = 8; • 8*7 mod 10 = 6 = M (message)

15

Public Key Encryption
• The first known asymmetric public key algorithm, the RSA algorithm, was published in 1978 by Ron Rivest, Adi Shamir, and Leonard Adleman at MIT's Laboratory for Computer Science. • The group had been inspired by earlier work at Stanford University by Whitfield Diffie and Martin Hellman

16

Public Key Encryption
• Public key systems use two keys (asymmetric)-- a public key known to everyone and a private or secret key known only to the recipient of the message. • When Bob wants to send a secure message to Alice, he uses Alice’s public key to encrypt the message. • Alice then uses her private key to decrypt it.
17

Public Key Encryption
Bob
Hash Function hello Set of Integer s Alice’s Public Key Encrypted Message

Insecure channel

Alice
Inverse Hash Function hello Set of Integers Alice’s Private Key Encrypted Message
18

Public Key History
Rivest was struck by the idea of public key encryption while nursing a headache on a couch. Rivest devised the system based on the notion that it is easy to multiply two large prime numbers to create an even larger number, but hard to start with the big number and find the prime factors.
19

Public Key History
Before they could present the system, however, Rivest was contacted by an employee of the National Security Administration, who warned him that if he presented the cryptography scheme at an upcoming conference, he could be violating the 1954 Munitions Control Act.

20

Public Key History
The act forbid the exporting of knowledge about cryptography, and since foreign nationals would be at the conference where he was scheduled to present, he could be exporting prohibited encryption technology.

21

Public Key History

MIT was able to resolve that issue with the NSA, which later said that the employee who contacted Rivest was acting on his own.

22

Public Key History
MIT decided to patent the algorithm, but because it had been published before the patent was applied for, it couldn't get foreign rights to it. MIT received the patent on September 20, 1983, and granted an exclusive license to the company, RSA Security. (Patent expired in 2000).

23

RSA
• Ron Rivest, Adi Shamir, and Len Adleman invented the most popular instantiation of public-key encryption, which has become known as RSA. • Alice, the sender, wants to send Bob, the receiver a message that Eve, the eavesdropper, cannot decrypt. • Bob has published a public key, KR, which Alice is to use to encrypt her message.
24

RSA
• Alice partitions her clear text message T into 32byte groups of ASCII letters, T0T1 ... Tn-1. • For i = 0 to n-1, she sends Ci, the remainder of (Ti)3/KR. • Bob's public key KR pq, where p and q are primes, each 2 greater than a multiple of 3. • To decrypt the message Bob computes s = (1/3)(2(p-1)(q-1) + 1). • He then decrypts each Ci by computing the remainder of (Ci)s)/KR, which we can show is Ti.
25

RSA
• These methods hinge on the fact that it is relatively easy (computationally) to multiply two large numbers, but it is quite difficult to factor a large number if the only factors are large prime numbers. Example: Try to factor 3233. See how long it takes.

26

RSA
• 53 and 61.

27

Attacking RSA
• Try to find primes p and q such that pq = KR.
– In 1977, Rivest, Shamir and Adleman issued a challenge to the world: break a small cipher text encrypted with RSA129, a 129-digit key. – RSA129 was cracked with the largest computation of all time (about 1000 computers around the world working 8 months). The secret message was: THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE. – It is estimated that with 250 digit keys and current factoring algorithms, you'd need 1000 computers for about 800 million months (or 100 billion computers for 8 months). – Thus, RSA is still deemed to be strong encryption.
28

Asymmetric-Key Encryption
Advantages • One can send secure message to someone without having to share any secret keys. Only public key is distributed. • The recipient can verify the identity of the sender.

29

Key Encryption
Send Money!

sende r

Encrypted Message

Insecure channel

Send Money!

Encrypted Message

30

Key Encryption
• The key is typically smaller than the message. • The message is broken into pieces and the key is used to encrypt each piece.

31

Key Encryption Example
• For example, the message might be
– “I have a secret”

• The key could be the binary number 01010101 • The message could be encoded into ascii code (hex)
49 20 68 61 76 65 20 61 20 73 65 63 72 65 74

32

Key Encryption Example
• The first character (“I” or hex 49) is encrypted using the key and “XOR” • Hex 49 = binary 01001001 • Key = binary 01010101 • XOR = binary 00011100 • So the encrypted character is 00011100
33

Key Encryption Example
• • • • To decrypt, you reverse the process XOR = binary 00011100 Key = binary 01010101 Character = binary 01001001

34

Key Encryption
• The key is the hardest to determine when it is as long as the message itself. • This is because the “pattern” left by the key does not repeat when the message gets encoded

35

Key Encryption Strategies
1. Symmetric key – the sender and receiver of a message share a single, common key that is used to encrypt and decrypt the message (fast) 2. Asymmetric key – utilizes two keys - one key to encrypt the message and a different key to decrypt the message (slow)

36

RSA Cryptosystem
• Setup:
– n = pq, with p and q primes – e relatively prime to φ(n) = (p − 1) (q − 1) – d inverse of e in Zφ(n)

• Example
– Setup:
• p = 7, q = 17 • n = 7⋅17 = 119 ∀ φ(n) = 6⋅16 = 96 • e=5 • d = 77

• Keys:
– Public key: KE = (n, e) – Private key: KD = d

– Keys:
• public key: (119, 5) • private key: 77

• Encryption:
– Plaintext M in Zn – C = Me mod n

– Encryption:
• M = 19 • C = 195 mod 119 = 66

• Decryption:
– M = Cd mod n

– Decryption:
• C = 6677 mod 119 = 19
37

Complete RSA Example
• Setup:
– p = 5, q = 11 – n = 5⋅11 = 55 φ(n) = 4⋅10 = 40 –e = 3 – d = 27 (3⋅27 = 81 = 2⋅40 + 1)
M C M C M C 1 1 19 39 37 53 2 8 20 25 38 37 3 27 21 21 39 29 4 9 22 33 40 35 5 15 23 12 41 6 6 51 24 19 42 3 7 13 25 5 43 32 8 17 26 31 44 44 9 14 27 48 45 45 10 10 28 7 46 41

• Encryption
– C = M3 mod 55

• Decryption
– M = C27 mod 55

11 11 29 24 47 38

12 23 30 50 48 42

13 52 31 36 49 4

14 49 32 43 50 40

15 20 33 22 51 46

16 26 34 34 52 28

17 18 35 30 53 47

18 2 36 16 54 54
38

Using simple statistics and properties of the language for cryptanalysis

Frequency of letters in English text: - (A, E, O, T) is approximately 40% (38.71% in the above table)
- (A, E, O, T, N, I) is approximately 50% (52.10 in the above table)
39

Polyalphabetic substitution
a o

Vigenere tableau (26 x 26 matrix)

u

The cipher letter ci is found in the pi-th row and ki-th column
Key (ki) Plain text (pi) Cipher text (ci) i a m i e x i s t t h a t i s c e r H I j t
40

M A C H I u a o p m

N E S C A k m k v t

N N O T T u n h b l

N K

m e d

Cryptanalysis of polyalphabetic substitutions: Kasiski method for repeated patterns Key: dickens

Plain text

41

The RSA Bunch Then

Adi Shamir, Ron Rivest, Len Adleman (1977)

42

The RSA Bunch Now

Adi Shamir, Ron Rivest, Len Adleman (2000)

43

The End
Thanks

44

Sign up to vote on this title