axiom
Both sides use the same encryption rules --------- key (symmetric encryption algorithms DES ) the Data Encryption Standard
The biggest problem
The two sides together to develop -------- way: key exchange algorithm, without directly passing key ------------------ private key (asymmetric encryption algorithm RSA ) three mathematicians Rivest , Shamir and Adleman
Coprime relations
In addition to an outside, there is no other common factors , such as, 15 and 32 have no common factors :
- Any two prime numbers constitute prime relationship, such as 13 and 61 .
- Is a prime number, as long as the number is not a multiple of the other former, both constitute prime relationship, such as 3 and 10 .
- If the two numbers among the larger the number is a prime number, the prime both constituting relationship, such as 97 and 57 .
- 1 and is an arbitrary natural number is a prime relationship, such as 1 and 99 .
- p is greater than an integer, then p and p-1 constituting the prime relationship, such as 57 and 56 .
6. The p is greater than 1 odd, the p , and p-2 constituting the prime relationship, such as 17 and 15 .
Euler function
Any positive integer n , ask <= n being a positive integer, the number and n constitute a relatively prime relationship? ----- Euler function
F (n) = n * (1 - 1 / p1) * (1 - 1 / p2) * (1 - 1 / p3) * (1 - 1 / p4)
P (1323) = F (3 ^ 3 * 7 ^ 2) = 1323 * ( 1 - 01/03 ) ( 1 - 1/7 )
Euler's theorem
----- A and b are coprime
A ^ [Phi] ------- (b) =. 1 (b MOD) ----- " A of ( b Euler function) th power minus one : equal : aliquot b
3 and 7 are coprime, and 7 Euler function [Phi] (7) is equal to 6 , so 3 of 6 power ( 729 ) minus 1 , may be 7 divisible ( 728/104 = 7 )
Modular multiplicative inverse
If the two positive integers a and n prime, then we can find the integer B , such that the ab-1 was n divisible, or ab is n remainder except that 1
------- Now == 1 (mod n)
-------a*a^(Φ(b) - 1) = 1 (mod b)
Key generation step of
Public and private keys
The first step, two randomly chosen prime number unequal p and Q ----------------- 61 is and 53
A second step of calculating p and q product of n- ------------------------------ 3233 written in binary is 110010100001 , a total of 12 bit, so the key is 12 bits practical applications, RSA keys are typically 1024 bits, important occasions, compared with 2048 bit
n = p×q
A third step of calculating n Euler function [Phi] (n) ----------------- [Phi] (3233) is equal to 60 × 52 is , i.e., 3120
φ(n) = (p-1)(q-1)
A fourth step of selecting a random integer E , with the proviso that . 1 ------------ in . 1 to 3120 among randomly selected 17 , the practical application, often chosen 65537
e ≡ range (1, z (n))
A fifth step of calculating e to φ (n) mode counter elements d
ed ≡ 1 (mod φ (n )) ------------------ 17x + 3120y = 1 ( linear equations )
A sixth step, the n and e packaged as a public key, n , and d packaged as private
Wherein a solution (X, Y) = (2753, -15) , i.e. d = 2753
= 3233 n- , E =. 17 , D = 2753 , so that the public key (3233,17) , the private key is ( 3233, 2753 )
Product quality, random, modular multiplicative inverse, the public key ( quality product, random ), the private key (product quality, modular multiplicative inverse)
Reliability of the RSA algorithm
( . 1 ) ed≡1 (MOD [Phi] (n-)) . Only those e and [Phi] (n-) , was calculated to D .
( 2 ) [Phi] (n-) = (. 1-P) (Q-. 1) . Only you know p and q , in order to calculate [phi] (the n-) .
( . 3 ) n-= PQ . Only n factorization to calculating p and Q . --------- n root 2
33478071698956898786044169
84821269081770479498371376
85689124313889828837938780
02287614711652531743087737
814467999489
×
36746043666799590428244633
79962795263227915816434308
76426760322838157396665112
79233373417143396810270092
798736308917
Encryption and decryption
An encryption use the public key (n, e)
Information m must be an integer (string can take ascii value or unicode value) , and m must be less than n
me ≡ c (mod n)
Alice's public key (3233, 17) , Bob m assumption that 65
65 * 17 ≡ 2790 (mod 3233)
Bob put 2790 was sent to Alice
2 decryption use the private key (n, d)
With its private key (3233, 2753) to decrypt
cd ≡ m (mod n)
2790 * 2753 ≡ 65 (mod 3233)
If you want to encrypt greater than n integer, how to do? There are two solutions: one is to split the information into several long short message segments, each segment are encrypted; the other is to choose a " symmetric encryption algorithm " (such as the DES ), the key of this algorithm encrypted information, and then the RSA public key encryption DES key.
Proof private key to decrypt
Finally, we have to prove why decrypted with the private key, you will be able to properly get m . That is proof of the following formula:
cd ≡ m (mod n)
Because, according to the encryption rule
me ≡ c (mod n)
Then, C can be written as follows:
c = me - kn
The c substituting want us to prove that the decryption rule:
(me - kn)d ≡ m (mod n)
It is equivalent to confirmation
with ≡ m (mod n)
due to
ed ≡ 1 (v φ (n))
and so
ed = hφ(n)+1
The ed substitution:
mhφ(n)+1 ≡ m (mod n)
Next, this is divided into two cases to prove the above formula.
( . 1 ) m and n are coprime.
Euler's theorem, at this time
mφ(n) ≡ 1 (mod n)
get
(mφ(n))h × m ≡ m (mod n)
The original style was demonstrated.
( 2 ) m and n relationship is not prime.
In this case, n is equal to the prime number p and q the product, so that m must be equal to kp or KQ .
To m = kp an example, consider the case k and q necessarily coprime, according to the Euler's theorem, the following equation holds:
(kp)q-1 ≡ 1 (mod q)
Further
[(kp)q-1]h(p-1) × kp ≡ kp (mod q)
which is
(kp)ed ≡ kp (mod q)
It will be rewritten to the following equation
(Kp) ed = tq + kp
At this time t necessarily be p divisible, i.e. t = t'p
(Kp) th = t'pq + kp
Since m = KP , n-= PQ , so
with ≡ m (mod n)
The original style was demonstrated.
result:
Encryption: Information * Random = encrypted information * Euler function
Decryption: encryption information * die trans = information * Euler function
Core: random * die trans = 1 * Euler function
Application :
A segment encryption
2 with the DES encryption information, using RSA encryption DES key