Proof of RSA Encryption Operation Algorithm

This section discusses how to prove the RSA encryption operation algorithm.

We can also prove the encryption operation algorithm presented in the previous section in the following way:

Given integers M, e, and n
Express e as a binary expression:
   e = e[0]*2**k + e[1]*2**(k-1) + ... + e[k-1]*2**1 + e[k]*2**0

Given C = M**e mod n 

Replace e with the binary expression:
   C = M**(e[0]*2**k + e[1]*2**(k-1) + ... + e[k-1]*2**1 
       + M**e[k]*2**0) mod n

Split and simply the e[k] term:
   C = M**(e[0]*2**k + e[1]*2**(k-1) + ... ) * M**e[k] mod n
     
Factor remaining terms:
   C = (M**(e[0]*2**(k-1) + e[1]*2**(k-2) + ... + e[k-1]*2**0))**2
       * M**e[k] mod n

Split and simply the e[k-1] term:
   C = (M**(e[0]*2**(k-1) + e[1]*2**(k-2) + ...) * M**e[k-1])**2 
       * M**e[k] mod n

Repeat last two steps for e[k-2], ... e[0] terms:
   C = ((...((M**e[0])**2 * M**e[1])**2 * ...)**2 * M**e[k-1])**2
       * M**e[k] mod n
       
Move "mod n" into each team:
   C = ((...((M**e[0] mod n)**2 * M**e[1] mod n)**2 * ...)**2 
       * M**e[k-1] mod n)**2 
       * M**e[k] mod n

As you can see from the last expression, the "(...)**2 * M**e[i] mod n" is a repeating pattern. This leads us to the following algorithm to calculate "C = M**e mod n":

Given integers M, e, and n

Calculcate "C = M**e mod n":
Step 1. Represent e in binary format and 
   store it binary digits in array e[0], e[1], ..., e[k]
Step 2. Set the variable C to 1
Step 3. For each i from 0 to k, repeat step 3a
Step 3a. C is reset to "C**2 * M**e[i] mod n"

This algorithm is identical to the algorithm presented in the previous section, because "* M**e[i]" is optional if e[i]=0.

Table of Contents

 About This Book

 Cryptography Terminology

 Cryptography Basic Concepts

 Introduction to AES (Advanced Encryption Standard)

 Introduction to DES Algorithm

 DES Algorithm - Illustrated with Java Programs

 DES Algorithm Java Implementation

 DES Algorithm - Java Implementation in JDK JCE

 DES Encryption Operation Modes

 DES in Stream Cipher 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

 How Secure Is RSA Algorithm?

 How to Calculate "M**e mod n"

 Efficient RSA Encryption and Decryption Operations

Proof of RSA Encryption Operation Algorithm

 Finding Large Prime Numbers

 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

 MD5 Mesasge Digest Algorithm

 SHA1 Mesasge Digest Algorithm

 OpenSSL Introduction and Installation

 OpenSSL Generating and Managing RSA Keys

 OpenSSL Managing Certificates

 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"

 Using Certificates in IE

 Using Certificates in Google Chrome

 Using Certificates in Firefox

 Archived Tutorials

 References

 Full Version in PDF/EPUB