1. “Public Key Cryptography
and RSA”
Presented By,
Er. Swapnil V. Kaware
svkaware@yahoo.co.in
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
2. Private-Key Cryptography
• Traditional private/secret/single key cryptography
uses one key
• Key is shared by both sender and receiver
• if the key is disclosed communications are
compromised
• also known as symmetric, both parties are equal
– hence does not protect sender from receiver forging a
message & claiming is sent by sender .
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
3. Public-Key Cryptography
• Probably most significant advance in the 3000 year
history of cryptography
• uses two keys – a public key and a private key
• asymmetric since parties are not equal
• uses clever application of number theory concepts to
function
• complements rather than replaces private key
cryptography
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
4. Public-Key Cryptography
• public-key/two-key/asymmetric cryptography
involves the use of two keys:
– a public-key, which may be known by anybody, and can be
used to encrypt messages, and verify signatures
– a private-key, known only to the recipient, used to decrypt
messages, and sign (create) signatures
• is asymmetric because
– those who encrypt messages or verify signatures cannot
decrypt messages or create signatures
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
6. 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
comes intact from the claimed sender
• public invention due to Whitfield Diffie &
Martin Hellman at Stanford U. in 1976
– known earlier in classified community
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
7. Public-Key Characteristics
• Public-Key algorithms rely on two keys with
the characteristics that it is:
– computationally infeasible to find decryption key
knowing only algorithm & encryption key
– computationally easy to en/decrypt messages
when the relevant (en/decrypt) key is known
– either of the two related keys can be used for
encryption, with the other used for decryption (in
some schemes)
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
9. Public-Key Applications
• can classify uses into 3 categories:
– encryption/decryption (provide secrecy)
– digital signatures (provide authentication)
– key exchange (of session keys)
• some algorithms are suitable for all uses,
others are specific to one
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
10. Security of Public Key Schemes
• like private key schemes brute force exhaustive
search attack is always theoretically possible
• but keys used are too large (>512bits)
• security relies on a large enough difference in
difficulty between easy (en/decrypt) and hard
(cryptanalyse) problems
• more generally the hard problem is known, its just
made too hard to do in practise
• requires the use of very large numbers
• hence is slow compared to private key schemes
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
11. Diffie-Hellman
The Diffie–Hellman (DH) key exchange technique was first defined
in their seminal paper in 1976.
DH key exchange is a method of exchanging public (i.e. non-secret)
information to obtain a shared secret.
DH is not an encryption algorithm.
DH key exchange has the following important properties:
1. The resulting shared secret cannot be computed by either of the
parties without the cooperation of the other.
2. A third party observing all the messages transmitted during DH
key exchange cannot deduce the resulting shared secret at the
end of the protocol.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
12. Principle behind DH
DH key exchange was first proposed before there were any known
public key algorithms, but the idea behind it motivated the hunt for
practical public key algorithms.
DH key exchange is not only a useful and practical key
establishment technique, but also a significant milestone in the
history of modern cryptography.
DH key exchange assumes first that there exists:
1. A public key cipher system that has a special property (we come to
this shortly).
2. A carefully chosen, publicly known function F that takes two
numbers x and y as input, and outputs a third number F(x,y) (for
example, multiplication is such a function).
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
13. Principle behind DH
Assume that Alice and Bob are the parties who wish to establish a
shared secret, and let their public and private keys in the public key
cipher system be denoted by (PA , SA) and (PB , SB) respectively.
The basic principle behind Diffie–Hellman key exchange is as follows:
1. Alice and Bob exchange their public keys PA and PB.
2. Alice computes F(SA , PB)
3. Bob computes F(SB, PA)
4. The special property of the public key cipher system, and the choice
of the function F, are such that F(SA , PB) = F(SB, PA). If this is the
case then Alice and Bob now share a secret.
5. This shared secret can easily be converted by some public means
into a bitstring suitable for use as, for example, a DES key.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
14. Diffie-Hellman key exchange
The most commonly described implementation of DH key exchange uses
the keys of the ElGamal cipher system and a very simple function F.
The system parameters (which are public) are:
• a large prime number p – typically 1024 bits in length
• a primitive element g
a
1. Alice generates a private random value a, calculates g (mod p)
and sends it to Bob. Meanwhile Bob generates a private random
b
value b, calculates g (mod p) and sends it to Alice.
b
2. Alice takes g and her private random value a to compute
b a
ab
(g ) = g (mod p).
a
3. Bob takes g and his private random value b to compute
a b
ab
(g ) = g (mod p).
ab
4. Alice and Bob adopt g
(mod p) as the shared secret.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
15. Diffie-Hellman
• Based on a special case of the
subset-sum, or knapsack, problem
20
11
8
5
6
4
Subset-sum Problem
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
16. Diffie-Hellman Example
• Block cipher
• Block size of 7 bits. Possible 27 combinations
• Private key (a’1, a’2, … , a’n) of 7 integers: (1, 2, 5, 11, 32, 87, 141)
• Chose two special integers, w and m, such that w and m are relatively prime,
meaning gcd(w,m) = 1: w = 901, m = 1234
• Public key (a1, a2, … , an) of 7 integers using the equation: ai = w * a’i mod m:
(901, 568, 803, 39, 450, 645, 1173)
• Partition SECRET into 7 bit blocks each block consisting of xn bits (x1, x2, …, xn)
S
1010011
E
1000101
C
1000011
R
1010010
E
1000101
T
1010100
n
• Bx = ∑ xiai
i=1
• S = 1 X (901) + 0 X (568) + 1 X (803) + 0 X (39) + 0 X (450) + 1 X (645) + 1 X (1173)
• S = 3522
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
17. Diffie-Hellman Example
• Encrypted blocks Bx received. Special version of subset-sum problem
• Which subset of (a’1, a’2, … , a’n) sums to B’x where B’x = Bx * w-1 mod m
• w-1 is the modular inverse of w for m, w * w-1 mod m = 1
• B’x = 3522 X (901)-1 mod 1234
• B’x = 3522 X 1171 mod 1234
• B’x = 234
1. sum ← 0
2. for i = n step -1 until 1 do
if ai + sum <= B’x
then sum ← sum + ai;
subset(i) ← 1
else subset(i) ← 0
3. if sum = B’x then exit with subset
else exit with “failure”
• Private key (1, 2, 5, 11, 32, 87, 141), B’x = 234, find subset (1, 0, 1, 0, 0, 1, 1) = S
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
18. Diffie-Hellman
• Two possible points of vulnerability
• An algorithm which solves NP-complete
problems quickly
• An algorithm that solves the particular
problem on which a cryptographic system
is based.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
19. RSA
• by Rivest, Shamir & Adleman of MIT in 1977
• best known & widely used public-key scheme
• based on exponentiation in a finite (Galois) field over
integers modulo a prime
– nb. exponentiation takes O((log n)3) operations (easy)
• uses large integers (eg. 1024 bits)
• security due to cost of factoring large numbers
– nb. factorization takes O(e log n log log n) operations (hard)
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
20. The RSA Algorithm
• Pick two large (100 digit) primes p and q.
• Let n = pq
• Select a relatively small integer d that is prime to
(p-1)(q-1)
• Find e, the multiplicative inverse of d mod (p-1)(q-1)
• (d,n) is the public key. To encrypt M, compute
– En(M) = Me(mod n)
• (e,n) is the private key. To decrypt C, compute
– De(C) = Cd(mod n)
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
21. RSA example
•
•
•
•
•
•
•
•
•
Let p = 11, q = 13
n = pq = 143
(p-1)(q-1) = 120 = 3 x 23 x 5
Possible d: 7, 11, 13, 17, … (let’s use 7)
Find e: e*7 = 1(mod 120) = 103
Public key: (7, 143)
Private key: (103, 143)
En(42) = 427 (mod 143) = 81
De(81) = 81103(mod 143) = 42
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
22. Correctness of RSA
• To show RSA is correct, we must show that
encryption and decryption are inverse
functions:
– En(De(M)) = De(En(M)) = M = Med (mod n)
– Since d and e are multiplicative inverses, there
is a k such that:
•
•
•
•
ed=1+ kn = 1 + k(p-1)(q-1)
Med = M1+k(p-1)(q-1) = M*(Mp-1)k(q-1)
By Fermat: Mp-1=1(mod p)
Med = M(1)k(q-1)(mod p) = M(mod p)
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
23. Correctness of RSA
•
•
•
•
Med = M(1)k(q-1)(mod p) = M(mod p)
Med = M(1)k(q-1)(mod q) = M(mod q)
By Chinese Remainder Thm, we get:
M^{ed} = M (mod p) M (mod q) =
M (mod pq) = M (mod n)
• Therefore, RSA reproduces the original
message and is correct.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
24. Strengths of RSA
•
•
•
•
No prior communication needed
Highly secure (for large enough keys)
Well-understood
Allows both encryption and signing
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
25. Weaknesses of RSA
• Large keys needed (1024 bits is current
standard)
• Relatively slow
– Not suitable for very large messages
• Public keys must still be distributed safely.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
26. RSA Key Setup
• each user generates a public/private key pair by:
• selecting two large primes at random - p, q
• computing their system modulus N=p.q
– note ø(N)=(p-1)(q-1)
• selecting at random the encryption key e
• where 1<e<ø(N), gcd(e,ø(N))=1
• solve following equation to find decryption key d
– e.d=1 mod ø(N) and 0≤d≤N
• publish their public encryption key: KU={e,N}
• keep secret private decryption key: KR={d,p,q}
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
27. RSA Use
• to encrypt a message M the sender:
– obtains public key of recipient KU={e,N}
– computes: C=Me mod N, where 0≤M<N
• to decrypt the ciphertext C the owner:
– uses their private key KR={d,p,q}
– computes: M=Cd mod N
• note that the message M must be smaller
than the modulus N (block if needed)
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
28. Why RSA Works
• because of Euler's Theorem:
• aø(n)mod N = 1
– where gcd(a,N)=1
• in RSA have:
–
–
–
–
N=p.q
ø(N)=(p-1)(q-1)
carefully chosen e & d to be inverses mod ø(N)
hence e.d=1+k.ø(N) for some k
• hence :
Cd = (Me)d = M1+k.ø(N) = M1.(Mø(N))q = M1.(1)q =
M1 = M mod N
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
29. RSA Example
Select primes: p=17 & q=11
Compute n = pq =17 11=187
Compute ø(n)=(p–1)(q-1)=16 10=160
Select e : gcd(e,160)=1; choose e=7
Determine d: de=1 mod 160 and d < 160
Value is d=23 since 23 7=161= 10 160+1
6. Publish public key KU={7,187}
7. Keep secret private key KR={23,17,11}
1.
2.
3.
4.
5.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
30. RSA Example cont
• sample RSA encryption/decryption is:
• given message M = 88 (nb. 88<187)
• encryption:
C = 887 mod 187 = 11
• decryption:
M = 1123 mod 187 = 88
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
31. Exponentiation
•
•
•
•
can use the Square and Multiply Algorithm
a fast, efficient algorithm for exponentiation
concept is based on repeatedly squaring base
and multiplying in the ones that are needed to
compute the result
• look at binary representation of exponent
• only takes O(log2 n) multiples for number n
– eg. 75 = 74.71 = 3.7 = 10 mod 11
– eg. 3129 = 3128.31 = 5.3 = 4 mod 11
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
33. RSA Key Generation
• users of RSA must:
– determine two primes at random - p, q
– select either e or d and compute the other
• primes p,q must not be easily derived from
modulus N=p.q
– means must be sufficiently large
– typically guess and use probabilistic test
• exponents e, d are inverses, so use Inverse
algorithm to compute the other
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
34. RSA Security
• three approaches to attacking RSA:
– brute force key search (infeasible given size of
numbers)
– mathematical attacks (based on difficulty of
computing ø(N), by factoring modulus N)
– timing attacks (on running of decryption)
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
35. Factoring Problem
• mathematical approach takes 3 forms:
– factor N=p.q, hence find ø(N) and then d
– determine ø(N) directly and find d
– find d directly
• currently believe all equivalent to factoring
– have seen slow improvements over the years
• as of Aug-99 best is 130 decimal digits (512) bit with GNFS
– biggest improvement comes from improved algorithm
• cf “Quadratic Sieve” to “Generalized Number Field Sieve”
– barring dramatic breakthrough 1024+ bit RSA secure
• ensure p, q of similar size and matching other constraints
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
36. Timing Attacks
• developed in mid-1990’s
• exploit timing variations in operations
– eg. multiplying by small vs large number
– or IF's varying which instructions executed
• infer operand size based on time taken
• RSA exploits time taken in exponentiation
• countermeasures
– use constant exponentiation time
– add random delays
– blind values used in calculations
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
37. What Is Message Authentication
• It’s the “source,” of course!
• Procedure that allows communicating parties to
verify that received messages are authentic(可
信的)
• Characteristics:
–
source is authentic – masquerading
–
contents unaltered – message modification
–
timely sequencing – replay
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
38. Approaches to Message
Authentication
• Authentication Using Conventional Encryption
– Assume only sender and receiver share a key
– Then a correctly encrypted message should be
from the sender
• Usually also contains error-detection
code, sequence number and time stamp
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
39. Message Authentication
•
Without Encryption
•
No confidentiality is preferred when:
1.
Same message is broadcast to many destinations
2.
Heavy load and cannot decrypt all messages – some
chosen at random
3.
No danger in sending plaintext
Append authentication tag to each message
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
40. Approaches to Message
Authentication
• Message Authentication without Message
Encryption
– An authentication tag is generated and appended to
each message-Message Authentication Code (MAC)
–
–
–
–
MAC is generated by using a secret key
Assumes both parties A,B share common secret key KAB
Code is function of message and key MACM= F(KAB, M)
Message plus code are transmitted
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
41. CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
42. Using Symmetric Ciphers for MACs
• can use cipher block chaining mode and use
final block as a MAC
• Data Authentication Algorithm (DAA) is a
widely used MAC based on DES-CBC
– using IV=0 and zero-pad of final block
– encrypt message using DES in CBC mode
– and send just the final block as the MAC
• or the leftmost M bits (16≤M≤64) of final block
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
43. What Is Message Authentication
• It’s the “source,” of course!
• Procedure that allows communicating parties to
verify that received messages are authentic
• Characteristics:
–
source is authentic – masquerading
–
contents unaltered – message modification
–
timely sequencing – replay
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
44. Approaches to Message
Authentication
• Authentication Using Conventional Encryption
– Assume only sender and receiver share a key
– Then a correctly encrypted message should be
from the sender
• Usually also contains error-detection
code, sequence number and time stamp
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
45. Message Authentication
•
Without Encryption
•
No confidentiality is preferred when:
1.
Same message is broadcast to many destinations
2.
Heavy load and cannot decrypt all messages – some
chosen at random
3.
No danger in sending plaintext
Append authentication tag to each message
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
46. Approaches to Message
Authentication
• Message Authentication without Message
Encryption
– An authentication tag is generated and appended to
each message-Message Authentication Code (MAC)
–
–
–
–
MAC is generated by using a secret key
Assumes both parties A,B share common secret key KAB
Code is function of message and key MACM= F(KAB, M)
Message plus code are transmitted
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
47. CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
48. Using Symmetric Ciphers for MACs
• can use cipher block chaining mode and use
final block as a MAC
• Data Authentication Algorithm (DAA) is a
widely used MAC based on DES-CBC
– using IV=0 and zero-pad of final block
– encrypt message using DES in CBC mode
– and send just the final block as the MAC
• or the leftmost M bits (16≤M≤64) of final block
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
50. One-way HASH function
• Alternative to Message Authentication Code
• Accepts a variable size message M as input and
produces a fixed-size message digest H (M) as
output
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
52. One Way Hash Function
Ideally We Would Like To Avoid Encryption
• Encryption software is slow
• Encryption hardware costs aren’t cheap
• Hardware optimized toward large data sizes
• Algorithms covered by patents
• Algorithms subject to export control
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
53. One-way HASH function
• Secret value is added before the hash and
removed before transmission.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
54. Secure HASH Functions
•
Purpose of the HASH function is to produce a “fingerprint”.
•
Properties of a HASH function H :
1.
H can be applied to a block of data at any size
2.
H produces a fixed length output
3.
H(x) is easy to compute for any given x.
4.
For any given block h, it is computationally infeasible to find x such
that H(x) = h
5.
For any given block x, it is computationally infeasible to find
H(y) = H(x).
6.
It is computationally infeasible to find any pair (x, y) such that H(x) =
H(y)
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
with
55. Simple Hash Function
• General principle
– Input is a sequence of n-bit blocks
– Input is processed one block at a time to produce
an n-bit hash function
– A simple example is the bit-by-bit XOR of each
block
Ci = bi1 ⊕bi2⊕ … ⊕bim
Ci is ith bit of hash code 1 <= i <= n
m is number of n-bit block in input
bij is ith bit in jth block
⊕ is the XOR CNS Notes by, Er. Swapnil V. Kaware
operation
(svkaware@yahoo.co.in)
57. SHA-1 Secure Hash Function
• The Secure Hash Algorithm( SHA) was developed by the
National Institute of Standards and Technology and
published in 1993. SHA-1 is 1995 revised version.
• It takes as input a message with maximum length < 264
bits and produces a 160-bit message digest.
• It is processed in 512-bit blocks.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
58. SHA-1 Secure Hash Function
K
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
59. SHA-1 Processing of single 512-Bit Block
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
60. SHA-1 -Creation of 80-word
Wt=(Wt-16 Wt-14 Wt-8 Wt-3) <<1
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
61. Other Secure HASH functions
SHA-1
MD5
RIPEMD-160
Digest length
160 bits
128 bits
160 bits
Basic unit of
processing
512 bits
512 bits
512 bits
Number of steps
80 (4 rounds of
20)
64 (4 rounds
of 16)
160 (5 paired
rounds of 16)
Maximum message
size
264-1 bits
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
62. Public-Key Cryptography Principles
• The use of two keys has consequences in: key
distribution, confidentiality and authentication.
• The scheme has six ingredients (see Figure 3.7)
– Plaintext
– Encryption algorithm
– Public and private key
– Ciphertext
– Decryption algorithm
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
65. Applications for Public-Key
Cryptosystems
• Three categories:
– Encryption/decryption: The sender encrypts a
message with the recipient’s public key.
– Digital signature: The sender ”signs” a message
with its private key.
– Key echange: Two sides cooperate two exhange a
session key.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
66. Public-Key Cryptographic Algorithms
• RSA - Ron Rives, Adi Shamir and Len Adleman
at MIT, in 1977.
– RSA is a block cipher
– The most widely implemented
– based on exponentiationin a finite field over
integers modulo a prime
– uses large integers (eg. 1024 bits)
– security due to cost of factoring large numbers
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
67. Prime and Composite Numbers
• An integer p is prime if its divisors are 1 and p
only.
• Otherwise, it is a composite number.
• E.g. 2,3,5,7 are prime; 4,6,8,9,10 are not
• List of prime number less than 200:
2 3 5 7 11 13 17 19 23 29 31 37
41 43 47 53 59 61 67 71 73 79 83 89
97 101 103 107 109 113 127 131 137
139 149 151 157 163 167 173 179 181
191 193 197 199
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
68. Prime Factorization ()
• To factor a number n is to write it as a product of other numbers:
n=a×b×c
• The prime factorization of a number n is when it is written as a product of
primes
• E.g. 91=7×13; 3600=24×32×52
• It is generally hard to do (prime) factorization when the number is large
• E.g. factorize
93874093217498173983210748123487143249761
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
69. Relatively Prime Numbers & GCD
• two numbers a, b are relatively primeif have no common divisorsapart
from 1
– eg.
8 & 15 are relatively prime since factors of 8 are 1,2,4,8 and of 15 are
1,3,5,15 and 1 is the only common factor
• conversely can determine the GCD(greatest common divisor) by comparing
their prime factorizations and using least powers
– eg.
300=21×31×52
18=21×32
GCD(18,300)=21×31×50=6
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
hence
70. The Euler phi Function
For n 1, let (n) denote the number of integers in the interval [1, n]
which are relatively prime to n. The function is called the Euler phi
function (or the Euler totient function).
Fact 1. The Euler phi function is multiplicative. I.e. if gcd(m, n) = 1,
then (mn) = (m) x (n).
E.g.
91=7×13
(7) =6
(13)=12
(91) = (7) × (13) =6×12=72
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
71. Summary
• Public key encryption provides a flexible system for secure
communication in open environments.
• Based on one-way functions.
• Allows for both authentication and signing.
• Secure public key distribution remains a problem. RSA is a public
key encryption algorithm whose security is believed to be based on
the problem of factoring large numbers.
• ElGamal is a public key encryption algorithm whose security is
believed to be based on the discrete logarithm problem.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
72. Summary
• Public key systems replace the problem of distributing symmetric keys
with one of authenticating public keys.
• Public key encryption algorithms need to be trapdoor one-way
functions.
• RSA is less efficient and fast to operate than most symmetric
encryption algorithms because they involve modular exponentiation.
• DH key exchange is an important protocol on which many real key
exchange protocols are based.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)
73. References
• A.K. Dewdney, The New Turning Omnibus, pp. 250-257, Henry Holt and Company, 2001.
• RSA Cryptosystem, http://primes.utm.edu/glossary/page.php?sort=RSA.
• Cryptology FAQ, http://www.faqs.org/faqs/cryptography-faq/part06/.
• A. Shamir, “A Polynomial-Time Algorithm for Breaking the Basic Merkle-Hellman
Cryptosystem", Advances in Cryptology - CRYPTO '82 Proceedings, pp. 279-288, Plenum Press,
1983. IEEE Transactions on Information Theory, Vol. IT-30, pp. 699-704, 1984.
• The Extended Euclidian
Algorithm, http://www.grc.nasa.gov/WWW/price000/pfc/htc/zz_xeuclidalg.html.
CNS Notes by, Er. Swapnil V. Kaware
(svkaware@yahoo.co.in)