3
3
3
UNIT 3 NOTES
Example:
a = 7, p = 19
72 = 49 ≡ 11 (mod 19)
74 ≡ 121 ≡ 7 (mod 19)
78 ≡ 49 ≡11 (mod 19)
716 ≡121 ≡ 7 (mod 19)
ap-1 = 718 ≡ 716 *72 ≡ 7*11≡ 1 (mod 19)
Example:
ø(21) = ø(3) * ø(7) = (3 - 1) * (7 - 1) = 2 * 6 = 12
where the 12 integers are {1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20}.
Euler’s Theorem
Euler’s theorem states that for every a and n that are relatively prime:
aø(n) ≡ 1(mod n)
Miller-Rabin Algorithm
any positive odd integer n ≥3 can be expressed as
n - 1 = 2kq with k > 0, q odd
n - 1 is an even integer. Then, divide (n - 1) by 2 until the result is an odd number q, for a total of k divisions.
If n is expressed as a binary number, then the result is achieved by shifting the number to the right until the
rightmost digit is a 1, for a total of k shifts.
Second Property:
Let p be a prime number greater than 2.
n -1 = 2kq with k > 0, q odd
Let a be any integer in the range 1<a<p - 1. Then one of the two following conditions is true.
Key Generation
Encryption
Plaintext: M<n
Ciphertext: C =Me mod n
Example:
P=17 q=11 e=7 M=88
The resulting keys are public key PU={7,187} and private key PR={23,187}.
Plaintext input of M = 88.
For encryption,
calculate C = 887 mod 187.
887 mod 187 = [(884 mod 187) * (882 mod 187) * (881 mod 187)] mod 187
881 mod 187 = 88
882 mod 187 = 7744 mod 187 = 77
884 mod 187 = 59,969,536 mod 187 = 132
887 mod 187 = (88 * 77 * 132) mod 187 = 894,432 mod 187 = 11
For decryption,
calculate M = 1123 mod 187
1123 mod 187 = [(111 mod 187) * (112 mod 187) * (114 mod 187) *
(118 mod 187) * (118 mod 187)] mod 187
1
11 mod 187 = 11
112 mod 187 = 121
114 mod 187 = 14,641 mod 187 = 55
118 mod 187 = 214,358,881 mod 187 = 33
1123 mod 187=(11* 121 * 55 * 33 * 33) mod 187 =79,720,245 mod 187= 88
Solve:
a. p = 3; q = 11, e = 7; M = 5
b. p = 5; q = 11, e = 3; M = 9
c. p = 7; q = 11, e = 17; M = 8
For two parties A and B, key distribution can be achieved in a number of ways, as follows:
User A wishes to establish a logical connection with B and requires a one-time session key to protect the
data transmitted over the connection. A has a master key, Ka, known only to itself and the KDC; similarly,
B shares the
master key Kb with the KDC. The following steps occur.
1. A issues a request to the KDC for a session key to protect a logical connection to B. The message includes
the identity of A and B and a unique identifier, N1, for this transaction, which we refer to as a nonce. The
nonce may be a timestamp, a counter, or a random number; the minimum requirement is that it differs with
each request. Also, to prevent masquerade, it should be difficult for an opponent to guess the nonce. Thus,
a random number is a good choice for a nonce.
2. The KDC responds with a message encrypted using Ka. Thus, A is the only one who can successfully
read the message, and A knows that it originated at the KDC. The message includes two items intended for
A:
this response with the appropriate request Thus, A can verify that its original request was not altered before
reception by the KDC and, because of the nonce, that this is not a replay of some previous request.
These last two items are encrypted with Kb (the master key that the KDC
shares with B). They are to be sent to B to establish the connection and prove A’s identity.
Because this information is encrypted with Kb, it is protected from eavesdropping. B now knows the session
key (Ks), knows that the other party is A (from IDA), and knows that the information originated at the KDC
(because it is encrypted using Kb).
4. Using the newly minted session key for encryption, B sends a nonce, N2, to A.
5. Also, using Ks, A responds with f(N2), where f is a function that performs
some transformation on N2
The more frequently session keys are exchanged, the more secure they are, because the opponent has less
ciphertext to work with for any given session key. On the other hand, the distribution of session keys delays
the start of any exchange and places a burden on network capacity. A security manager must try to balance
these competing considerations in determining the lifetime of a particular session key.
The use of a key distribution center imposes the requirement that the KDC be trusted and be protected from
subversion. This requirement can be avoided if key distribution is fully decentralized.
A decentralized approach requires that each end system be able to communicate in a secure manner with
all potential partner end systems for purposes of session key distribution. Thus, there may need to be as
many as [n(n - 1)]/2 master keys for a configuration with n end systems.
1. A uses B’s public key to encrypt a message to B containing an identifier of A(IDA) and a nonce (N1),
which is used to identify this transaction uniquely.
2. B sends a message to A encrypted with PUa and containing A’s nonce (N1) as well as a new nonce
generated by B (N2). Because only B could have decrypted message (1), the presence of N1 in message (2)
assures A that the correspondent is B.
3. A returns N2, encrypted using B’s public key, to assure B that its correspondent is A.
4. A selects a secret key Ks and sends M = E(PUb, E(PRa, Ks)) to B. Encryption of this message with B’s
public key ensures that only B can read it; encryption with A’s private key ensures that only A could have
sent it.
5. B computes D(PUa, D(PRb, M)) to recover the secret key.
• Public announcement
• Publicly available directory
• Public-key authority
• Public-key certificates
1. The authority maintains a directory with a {name, public key} entry for each participant.
2. Each participant registers a public key with the directory authority.
Registration would have to be in person or by some form of secure authenticated communication.
3. A participant may replace the existing key with a new one at any time, either because of the desire to
replace a public key that has already been used for a large amount of data, or because the corresponding
private key has been compromised in some way.
4. Participants could also access the directory electronically. For this purpose, secure, authenticated
communication from the authority to the participant is mandatory.
Public-Key Authority
• B’s public key, PUb, which A can use to encrypt messages destined for B
• The original request used to enable A to match this response with the corresponding earlier request and to
verify that the original request was not
altered before reception by the authority
• The original timestamp given so A can determine that this is not an old
message from the authority containing a key other than B’s current public key.
Public-Key Certificates
1. Any participant can read a certificate to determine the name and public key of the certificate’s owner.
2. Any participant can verify that the certificate originated from the certificate authority and is not
counterfeit.
3. Only the certificate authority can create and update certificates.
4. Any participant can verify the currency of the certificate.
where PRauth is the private key used by the authority and T is a timestamp.
D(PUauth, CA) = D(PUauth, E(PRauth, [T || IDA ||PUa])) = (T || IDA ||PUa)
There are publicly known numbers: a prime number „q‟ and an integer α that is
primitive root of q.
suppose users A and B wish to exchange a key. User A selects a random integer XA
integer XB < q and computes YB = α XB mod q. Each side keeps the X value private
and
makes the Y value available publicly to the other side. User A computes the key as
K = (YA)XB mod q
K = (YB)XA mod q
= (α XB)XA mod q
= (α XA)XB mod q
= (YA)XB mod q
The security of the algorithm lies in the fact that, while it is relatively easy to
calculate Exponentials
modulo a prime, it is very difficult to calculate discrete logarithms. For large primes,
Example:
Key exchange is based on the use of the prime number
q = 353 and a primitive root of 353, in this case α = 3. A and B select private keys
XA = 97 and XB = 233, respectively.
After they exchange public keys, each can compute the common secret key:
A computes K = (YB)X mod 353 = 24897 mod 353 = 160.
A
Suppose Alice and Bob wish to exchange keys, and Darth is the adversary. The attack proceeds as
follows.
1. Darth prepares for the attack by generating two random private keys XD1
and XD2 and then computing the corresponding public keys YD1 and YD2.
2. Alice transmits YA to Bob.
3. Darth intercepts YA and transmits YD1 to Bob. Darth also calculates
K2 = (YA)XD2 mod q.
4. Bob receives YD1 and calculates K1 = (YD1)XB mod q.
5. Bob transmits YB to Alice.
6. Darth intercepts YB and transmits YD2 to Alice. Darth calculates
K1 = (YB)XD1 mod q.
7. Alice receives YD2 and calculates K2 = (YD2)XA mod q.
The variant of the Diffie-Hellman key distribution scheme, allowing secure exchange
of
Messages published in 1985 by ElGamal in T. ElGamal, "A Public Key Cryptosystem
and a Signature Scheme Based on Discrete Logarithms",
Like Diffie-Hellman its security depends on the difficulty of factoring logarithms
Key Generation
select a large prime p (~200 digit), and
[[alpha]] a primitive element mod p
A has a secret number xA
B has a secret number xB
A and B compute yA and yB respectively, which are then made public
yA = [[alpha]]xA mod p
yB = [[alpha]]xB mod p
K = yB
k mod p
computes the ciphertext pair: C = {c1,c2}
Algorithm
Thus, K functions as a one-time key, used to encrypt and decrypt the message.
Example:
let us start with the prime field GF(19); that is, q = 19.
It has primitive roots {2, 3, 10, 13, 14, 15}. choose α = 10.
1. Alice chooses XA = 5.
2. Then YA = αXA mod q = α5 mod 19 = 3.
3. Alice’s private key is 5 and Alice’s public key is {q, a, YA} = {19, 10, 3}.
Suppose Bob wants to send the message with the value M = 17. Then,
1. Bob chooses k = 6.
2. Then K = (YA)k mod q = 36 mod 19 = 729 mod 19 = 7.
3. C1 = αk mod q = α6 mod 19 = 11
C2 = KM mod q = 7 * 17 mod 19 = 119 mod 19 = 5
4. Bob sends the ciphertext (11, 5).
For decryption:
1. Alice calculates K = (C1)XA mod q = 115 mod 19 = 161051 mod 19 = 7.
2. Then K-1 in GF(19) is 7-1 mod 19 = 11.
3. Finally, M = (C2K-1) mod q = 5 * 11 mod 19 = 55 mod 19 = 17.
Abelian Group:
an abelian group G, sometimes denoted by {G, • }, is a set of elements with a binary operation, denoted by
• , that associates to each ordered pair (a, b) of elements in G an element (a • b) in G
Elliptic curves are not ellipses. They are so named because they are described by cubic equations, similar
to those used for calculating the circumference of an ellipse. In general, cubic equations for elliptic curves
take the following form, known as a Weierstrass equation:
y2 + axy + by = x3 + cx2 + dx + e
where a, b, c, d, e are real numbers and x and y take on values in the real numbers.
y2 = x3 + ax + b
Such equations are said to be cubic, or of degree 3, because the highest exponent they contain is a 3. Also
included in the definition of an elliptic curve is a single element denoted O and called the point at infinity
or the zero point
y = √x3+ax+b
1. O serves as the additive identity. Thus O = -O; for any point P on the elliptic curve, P + O = P. In what
follows, we assume P ≠ O and Q ≠ O.
2. The negative of a point P is the point with the same x coordinate but the negative of the y coordinate;
that is, if P = (x, y), then -P = (x, -y).
Note that these two points can be joined by a vertical line.
Note that P + (-P) = P - P = O.
3. To add two points P and Q with different x coordinates, draw a straight line between them and find the
third point of intersection R. It is easily seen that there is a unique point R that is the point of intersection
P + P = 2P = R. When yP ≠ 0