Download presentation
Presentation is loading. Please wait.
1
Taehyung Kim HPC Lab. POSTECH
Cryptography Taehyung Kim HPC Lab. POSTECH
2
Goals To know To exercise simple cryptography algorithms
What is the cryptography? What is a key in cryptography system? What is a symmetric key system? What is a public key system? What is the base of the Public-key cryptography? To exercise simple cryptography algorithms
3
Cryptography Definition Objective The art of secret writing
Crypto(hidden) + graphy(writing) Objective To enable two people to communicate over an insecure channel in such a way that opponent cannot understand what is being said These two word, crypto and graphy, are from Greek Crypto means ‘hidden’ and graphy means ‘writing’ so cryptography is ‘hidden writing’ Here, an insecure channel can be a cyber space or a real world.
4
Cryptography The mostly used tool for securing information and services Relies on ciphers: mathematical functions used for encryption and decryption of a message Encryption – the process of disguising a message in such a way as to hide its substance Ciphertext – an encrypted message Decryption – the process of returning an ecrypted message back into plaintext Cryptography is a kind of mathematics. Cipher has same meaning with encrypt. So we call an encrypted message as a ciphertext. And we call an original message as a plaintext.
5
Ciphers For some message M Let’s denote Notice,
the encryption of that message into cipher text as Ek(M) = C the decryption into plain text as Dk(C) = M Notice, Symmetric-key algorithm Dk(Ek(M)) = M Public-key algorithm Dk1(Ek2(M))= M M is a plaintext. Ciphertext is generate by putting a plaintext into an encryption algorithms as its parameter. And we denote that like this. Also we can get the plaintext using a decryption algorithm Actually, there are two kinds of crypto algorithms. One is the symmetric-key algorithm and the other is the public-key algorithm Symmetric-key algorithms use the same key in encryption and decryption But public-key algorithms don’t. They use different keys.
6
Cryptosystem Algorithm + Key
The reason for having a key to an algorithm Difficult to devising new algorithms Difficult to quickly explain a newly devised algorithm to the person with whom you’d like to start communication securely A good cryptosystem Perfectly OK to have everyone know the algorithm Knowledge of the algorithm without the key does not help unmangle the information A crypto algorithm and keys constitute crypto system. Mangle means spoil or broke. Unmangle is opposite of mangle.
7
Classical Cryptography
Transposition (permutation) cipher Simple transposition Substitution cipher shift cipher Polyalphabetic cipher
8
Simple Transposition Grouping the plaintext into blocks of t characters Applying to each block a single permutation on the numbers 1 through t Encryption C = E(M) = m(1) …m(t), (M=m1…mt) Decryption M = D(C) = E-1(C) = c-1(1) …c-1(t), (C = c1…ct)
9
Example T = 6, = (6 4 1 3 5 2) M = CAESAR Exercise
Simple Transposition Example T = 6, = ( ) M = CAESAR m1 = C, m2 = A, m3 = E, m4 = S, m5 = A, m6 = R C = m6m4m1m3m5m2 = RSCEAA Exercise C = OPCYTRYPGAHR , M = ? -1 = ( ) M = D(C) = D({OPCYTR})D({YPGAHR}) = CRYPTOGRAPHY
10
Shift Cipher A kind of simple substitution ciphers Example
M = CAESAR m1 = C, m2 = A, m3 = E, m4 = S, m5 = A, m6 = R Ci = ( mi + 3) % 26 C = FDHVDU General shift cipher Ci = (a·mi + k) % 26 A simple substitution is a one-to-one correspondence of an alphabet with itself
11
Polyalphabetic (Vigenere) cipher
Grouping the plaintext into blocks of n characters -> block size = 5 = n Let E1,E2,…,En be distinct substitution ciphers. To encrypt a plaintext message M, apply the Ei( i=1,2,…,n) cyclically to the message characters Encryption C = E(M) = E1(m1)E2(m2)…En(mn)E1(mn+1)…. (M=m1…mt) Decryption M = D(C) = E1-1(c1)E2-1(c2)…En-1(cn)E1-1(cn+1)…(C = c1…ct)
12
Polyalphabetic Cipher
Example Block size = 3 E1, E2, E3 are shift ciphers with Key = { 2, 16, 5 } M = CRYPTOGRAPHY C = E1(C)E2(R)E3(Y)E1(P)E2(T)E3(O) E1(G)E2(R)E3(A)E1(P)E2(H)E3(Y) = EHDRJTIHFRXD
13
Cryptanalysis of a substitution cipher
Letter-frequency in English can be broken into 5 groups: e (0.127 most common occurrence); t, (0.091), a (0.082), o (0.075), i (0.070), n (0.067), s (0.063), h (0.061), r (0.060); d (0.043), l (0.040) ; c (0.028), u (0.028), m (0.024), w (0.023), f (0.022), g (0.020), y (0.020), p (0.019), b (0.015); v (0.010), k (0.008), j (0.002), x (0.001), q (0.001), z (0.001 least common)
14
Exercise Decipher a given ciphertext Key = { 5, 17, 4, 20 }
C = IVGCUYILFXMPJEGCUYILYVBN
15
Exercise Decipher a given ciphertext. ( you first find the block size. Look at the letters applied same substitution cipher, and see which letter occurs most frequently And using letter frequency in English, decipher. ) CHREEVOAHMAERATBIAXXWTNXBEEOPHBSBQMQEQERBWRVXUOAKXAOSXXWEAHBWGJMMQMNKGRFVGXWTRZXWIAKLXFPSKAUTEMNDCMGTSXMXBTUIADNGMGPSRELXNJELXVRVPRTULHDNQWTWDTYGBPHXTFALJHASVBFXNGLLCHRZBWELEKMSJIKNBHWRJGNMGJSGLXFEYPHAGNRBIEQJTAMRVLCRREMNDGLXRRIMGNSNRWCHRQHAEYEVTAQEBBIPEEWEVKAKOEWADREMXMTBHHCHRTKDNVRZCHRCLQOHPWQAIIWXNRMGWOIIFKEE
16
Public Key Cryptography
Problem with symmetric key algorithms A secure method of telling your partner the key A separate key for everyone you might communicate with Public-Key algorithms use a public-key and private-key pair over a message
17
Encryption Public Key Cryptography Public Key is opened to everyone.
But private key is a hidden key.
18
Public Key Cryptography
Authentication
19
RSA Public-key encryption
Proposed by Rivest, Shamir, and Adleman in 1977 Mostly widely used public-key cryptosystem The security is based on the intractability of the integer factorization problem
20
Key Generation Generate two large random primes p and q.
RSA Public Key Cryptography Key Generation Generate two large random primes p and q. Compute n = pq and = (p-1)(q-1). Select a random integer e, 1 < e < , such that gcd(e, ) = 1. Compute the unique integer d, 1 < d < , such that ed 1 (mod ). Public key : (n, e) Private key : d
21
Encryption Bob encrypts a message m for Alice
RSA Public Key Cryptography Encryption Bob encrypts a message m for Alice Obtain Alice’s public key (n, e) Represent the message as an integer m in the interval [0, n-1] Compute C Me (mod n) Alice recovers plaintext m from c as follows: M Cd (mod n)
22
Theorem: C Md (mod n) Proof C d (Me)d (mod n) Med (mod n)
RSA Public Key Cryptography Theorem: C Md (mod n) Proof C d (Me)d (mod n) Med (mod n) Mk+1 (mod n) MMk (mod n) MMk(p-1)(q-1) (mod n) M (mod n)
23
Example p = 2357, q = 2251 n = pq = 6012707, = (p-1)(q-1) = 6007800
RSA Public Key Cryptography Example p = 2357, q = 2251 n = pq = , = (p-1)(q-1) = Choose e = , then d = Public key (n = , e = ) Private key d = Plaintext m = C = me mod n = mod = Label the English characters A,B,… Z as integers 0,1,2,……,25
24
Exercise Public key (119, 5), private key d = 77 Plaintext M = 19
RSA Public Key Cryptography Exercise Public key (119, 5), private key d = 77 Plaintext M = 19 Ciphertext C = ? What about manual decryption ?
25
Exercise Find five prime integer more than 1000
RSA Public Key Cryptography Exercise Find five prime integer more than 1000 Make a public key and a private key Two primes, p and q, must be less than 1000 Select a plaintext and cipher it using your public key Decipher the other group’s ciphertext
26
Cryptography The cipher system is just a part of a protecting system.
Although the cipher system is obviously safe, it doesn't guarantee security of a protecting system. When all parts of protecting system (include a Security manager) are secure, we can say that "This system is secure against hacker's attack". Cryptography is not magic word for security. It is most important that the security manager must be concerned about the security. That’s it.
27
How to determine a block size
Kasiski's method: 1. Find all repeated strings in ciphertext of length at least 3 2. Compute distances between them 3. Block size will be a common divisor of those numbers
28
Letter-frequency e (0.127 most common occurrence);
t, (0.091), a (0.082), o (0.075), i (0.070), n (0.067), s (0.063), h (0.061), r (0.060); d (0.043), l (0.040) ; c (0.028), u (0.028), m (0.024), w (0.023), f (0.022), g (0.020), y (0.020), p (0.019), b (0.015); v (0.010), k (0.008), j (0.002), x (0.001), q (0.001), z (0.001 least common)
29
Answer A:7 B:6 C:6 D:4 E:1 F:2 G:0 H:0 I:1 J:2 K:1 L:0 M:2
N:4 O:0 P:1 Q:4 R:3 S:0 T:2 U:1 V:1 W:9 X:5 Y:0 Z:0 A:3 B:1 C:0 D:3 E:9 F:2 G:3 H:5 I:3 J:0 K:0 L:0 M:2 N:6 O:6 P:1 Q:0 R:3 S:7 T:5 U:1 V:1 W:1 X:0 Y:0 Z:0 A:5 B:2 C:1 D:0 E:2 F:0 G:4 H:3 I:3 J:3 K:0 L:2 M:0 N:5 O:1 P:2 Q:4 R:13 S:1 T:2 U:2 V:4 W:0 X:1 Y:2 Z:0 A:1 B:1 C:1 D:0 E:10 F:0 G:1 H:3 I:4 J:2 K:4 L:4 M:8 N:0 O:0 P:3 Q:2 R:3 S:1 T:1 U:0 V:3 W:3 X:4 Y:1 Z:2 A:3 B:5 C:0 D:0 E:2 F:2 G:7 H:6 I:0 J:0 K:4 L:6 M:5 N:0 O:0 P:1 Q:0 R:2 S:0 T:4 U:0 V:1 W:3 X:10 Y:0 Z:1 THEALMONDTREEWASINTENTATIVEBLOSSOMTHEDAYSWERELONGEROFTENENDINGWITHMAGNIFICENTEVENINGSOFCORRUGATEDPINKSKIESTHEHUNTINGSEASONWASOVERWITHHOUNDSANDGUNSPUTAWAYFORSIXMONTHSTHEVINEYARDSWEREBUSYAGAINASTHEWELLORGANIZEDFARMERSTREATEDTHEIRVINESANDTHEMORELACKADAISICALNEIGHBORSHURRIEDTODOTHEPRUNINGTHEYSHOULDHAVEDONEINNOVEMCALORBUSINESSRIVALSE
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.