4. 4
Authentication - Digital Signatures:
Basic Operation: Alice signs a message
Signature Creation
Message
Alice’s
Private Key
Signature Verification
OK?
Alice’s
Public
Key
Message + Signature
Bob’s
public key
ring
YES
NO
5. RSA хэрэглээ
• Developed by Ron Rivest, Adi Shamir, and Leonard Adleman at MIT in 1977
• Based on the current difficulty of factoring very large numbers
• Suitable for signing as well as encryption
• Үндсэн чиг үүрэг:
– Confidentiality provides using public key algorithm
– Authentication provides using Digital signature.
How RSA work
1.Generate random prime numbers
2. Generate public and private key
3. Key management /Publish public key/
a. public announcement
b. public available directory
c. public key authority
d. public key certificate
4. Encrypt plain text using public key
5. Decrypt cipher text using private key
6. RSA алгоритмын ажиллагаа
• Encryption (for confidentiality):
1. Encode p/text message as string of integers; 1 ≤ m ≤ n
2. For each of these integers, sender encrypts message (integer) m by
calculating: c = me mod n using recipient’s public key: (n, e)
3. Ciphertext consists of concatenation of each of these integers
• Decryption:
1. For each of the ciphertext integers,
Recipient decrypts c/text (integer) c by calculating: m = cd mod n
using recipient’s private key: (n, d)
2. Then decode from integers and concatenate to recover plaintext
9. RSA: another important property
The following property will be very useful later:
PR(PU (m)) = m PU(PR(m))=
use public key
first, followed
by private key
use private
key first,
followed by
public key
Result is the same!
10. Solve problem
• p=11, q=3
• n = ?
• e = ?
• φ(n) = ?
• d =?
• Public key = ?
• Private key = ?
• Plain text m=7
– Encryption =?
– Decryption =?
11. Solution
• Анхны тоонуудыг сонгоно p=11, q=3.
• n = pq = 11*3 = 33
φ(n) = (p-1)(q-1) = 10*2 = 20
• e=3 сонгоно
Шалгана gcd(e, (p-1)) = gcd(3, 10) = 1 (i.e. 3 and 10
have no common factors except 1),
and check gcd(e, q-1) = gcd(3, 2) = 1
therefore gcd(e,φ(n)) = gcd(e, ((p-1)(q-1))) = gcd(3, 20)
= 1
• Compute d such that ed ≡ 1 (mod φ(n))
i.e. compute d = e-1 mod φ(n) = 3-1 mod 20
i.e. find a value for d such that φ(n) divides (ed-1)
i.e. find d such that 20 divides 3d-1.
Simple testing (d = 1, 2, ...) gives d = 7
Check: ed-1 = 3.7 - 1 = 20, which is divisible by φ(n).
• Public key = (n, e) = (33, 3)
Private key = (n, d) = (33, 7).
12. Solution
• now say we want to encrypt the message
• m = 7,
c = me mod n = 73 mod 33 = 343 mod 33 = 13.
Hence the ciphertext c = 13.
• To check decryption we compute
m' = cd mod n = 137 mod 33 = 7.
13.
14. Diffie-Hellman key agreement
for system parameters p (a prime) and g
gXa mod p
Alice computes the shared
secret
(gXb) Xa = gXbXa mod p
Bob computes the same
secret
(gXa) Xb = gXaXb mod p.
Alice picks random
integer Xa
gXb mod p
Bob picks random
integer Xb
17. Түлхүүрийн амьдрах хугацаа
2242242432112
Protection
up to 20 years
192192177696
Protection up
to 10 years
160160124880
Protection
up to 3 years
Hash
Digital
Signature
Asymmetric
Key
Symmetric
Key
2562563248128
Protection up
to 30 years
51251215424256
Protection against
quantum computers
.
18. Quiz - 10 mins - 3 points
• gcd(3868, 1450) =?
• -30 mod (7) = ?
• a= 8 p=17 => батал.
•
• p=11, g=2, xA = 9, xB = 4 k=?
Bob chooses p=5, q=7. Then n=35, φ(n)=24.
e=5
d=?
33. Radix-64 формат
1. Хоёртын битийн
цувааг 24 битийн
блокуудад хуваана
(3 bytes).
2. 24 битийн блокоо
4 хэсэгт хуваана
3. 6 битийн хэсэг бүр
0-63 хоорондох
утга авна
4. Утга бүрт тэмдэгт
оноох боломжтой
болно
6 bit
value
Character
encoding
6 bit
value
Character
encoding
6 bit
value
Character
encoding
6 bit
value
Character
encoding
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Q
R
S
T
U
V
W
X
Y
Z
a
b
c
d
e
f
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(pad)
w
x
y
z
0
1
2
3
4
5
6
7
8
9
+
/
=