Cryptography Tutorials - Herong's Tutorial Examples - v5.42, by Herong Yang
Proof of RSA Public Key Encryption
This section describes steps to prove RSA Public Key Encryption algorithm. Fermat's little theorem is the key part of the proof.
To proof the RSA public key encryption algorithm, we need to proof the following:
Given that: p and q are 2 distinct prime numbers n = p*q m = (p-1)*(q-1) e satisfies 1 > e > n and e and m are coprime numbers d satisfies d*e mod m = 1 M satisfies 0 => M > n C = M**e mod n the following is true: M == C**d mod n
One way to prove the above is to use steps presented by Avi Kak at https://engineering.purdue.edu/kak/compsec/NewLectures/Lecture12.pdf
(a) Prove that "M**(e*d) mod p == M mod p" is true:
M**(e*d) mod p = M**(k1*m+1) mod p # because "d*e mod m = 1" = (M**(k1*m))*M mop p # factoring 1 M out = (M**(k1*(q-1)*(p-1)))*M mod p # because "m = (p-1)*(q-1)" = (M**(k2*(p-1)))*M mod p # set "k2 = k1*(q-1)" = ((M**(p-1) mod p)**k2)*M mod p # rearranging "mod p" If M and p are coprime numbers: M**(e*d) mod p = (1**k2)*M mod p # Fermat's little theorem: # M**(p-1) mod p = 1 # when M and p are coprimes = M mod p # done Else M == k*p must be true # because p is a prime number M mod p == 0 M**(e*d) mod p == 0 M**(e*d) mod p == M mod p # done
(b) Prove that "M**(e*d) mod q == M mod q" is true in the same process as above.
(c) Prove that "M == C**d mod n" is true:
M**(e*d) mod p == M mod p (1) # see proof (a) M**(e*d) - M == k3*p (2) # because of modulus operation M**(e*d) mod q == M mod q (3) # see proof (b) M**(e*d) - M == k4*q (4) # because of modulus operation M**(e*d) - M == k5*p*q (5) # because of (2) and (4) M**(e*d) - M == k5*n (6) # because n = p*q M mod n == M**(e*d) mod n (7) # because of modulus operation M == M**(e*d) mod n (8) # because 0=< M < n M == (M**e mod n)**d mod n (9) # moving "mod n" M == C**d mod n (10) # because C = M**e mod n
See you can see, the key part of the proof process is the "Fermat's little theorem", which says that if p is a prime number, then for any integer a, the number "a**p - a" is an integer multiple of p. See http://en.wikipedia.org/wiki/Fermat%27s_little_theorem for more details.
Table of Contents
Introduction to AES (Advanced Encryption Standard)
DES Algorithm - Illustrated with Java Programs
DES Algorithm Java Implementation
DES Algorithm - Java Implementation in JDK JCE
DES Encryption Operation Modes
PHP Implementation of DES - mcrypt
Blowfish - 8-Byte Block Cipher
Secret Key Generation and Management
Cipher - Secret Key Encryption and Decryption
►Introduction of RSA Algorithm
What Is Public Key Encryption?
RSA Public Key Encryption Algorithm
Illustration of RSA Algorithm: p,q=5,7
Illustration of RSA Algorithm: p,q=7,19
►Proof of RSA Public Key Encryption
Efficient RSA Encryption and Decryption Operations
Proof of RSA Encryption Operation Algorithm
RSA Implementation using java.math.BigInteger Class
Introduction of DSA (Digital Signature Algorithm)
Java Default Implementation of DSA
Private key and Public Key Pair Generation
PKCS#8/X.509 Private/Public Encoding Standards
Cipher - Public Key Encryption and Decryption
OpenSSL Introduction and Installation
OpenSSL Generating and Managing RSA Keys
OpenSSL Generating and Signing CSR
OpenSSL Validating Certificate Path
"keytool" and "keystore" from JDK
"OpenSSL" Signing CSR Generated by "keytool"
Migrating Keys from "keystore" to "OpenSSL" Key Files
Certificate X.509 Standard and DER/PEM Formats
Migrating Keys from "OpenSSL" Key Files to "keystore"