Secure Communication and Public Key Encryption

The "Key" Idea: Remember that A cryptosystem is a five-tuple (MATH) where the following conditions are satisfied:

1. $\QTR{bs}{P}$ is a finite set of possible plaintexts:

2. $\QTR{bs}{C}$ is a finite set of possible ciphertexts:

3. $\QTR{bf}{K}$ the keyspace, is the a finite set of possible keys:

4. For each K MATH there is and encryption rule e MATH and a corresponding decryption rule dMATH. Where

e MATH and d MATH are functions such that for all M $\in \QTR{bs}{P} $ ,dMATH(eMATH(M )) $\fallingdotseq $ M.

In general we think of cryptosystems as being used for two-way communication between individuals who want to carry on a private dialog. However, this is really not be practical for e-commerce. Consider the basic function of taking a credit card over the Web.

Suppose, however, that it were possible to find a cryptosystem for which knowing e MATH , and the general methodology used in its construction, did not lead to an easy computation of d MATH , then we could do the following.

Secure One-Way Communication: (eg Web Form)

1. Publish e MATH for the world to see. Tell the world that, if they want to communicate securely with you, all they need to is apply e MATH to the message before transmitting it. This because there is an acceptably small chance of someone discovering d MATH hence decoding there message.

2. When I received the encrypted message apply d MATH which, presumably only I know.


Figure

Secure Two-Way Communication:

Assume that we are dealing with a Cryptosystem such that

Suppose that we have two people PMATH and PMATH who want to communicate securely with each other. Each selects their own "one way system", K MATH and K MATH, from a Cryptosystem with the above listed properties .

PMATH and PMATH commmunicate as follows:

1. PMATH gives e MATH to PMATH and PMATH gives e MATH to PMATH.

2. Suppose PMATH wants to send message M to PMATH . PMATH computes C $=$e MATH(d MATH(M )) and transmits it.

3. PMATH computes e MATH(d MATH(C ))$=$ e MATH(d MATH(e MATH(d MATH(M ))))$=$ e MATH(d MATH(M ))$=$ M.

Why does this work?

sees is meaningful.

There are Examples of One Way Cryptosystems:

RSA ( The RSA algorithm was invented in 1978 by Ron Rivest, Adi Shamir, and Leonard Adleman):

1. Begin by choosing $\QTR{Large}{p}$ and $\QTR{Large}{q}$ to be two very large prime numbers.

2. Next choose $\QTR{Large}{e}$ , MATH, such that $\QTR{Large}{e}$ and MATH are relatively prime.

3. Referring back to the previous sections, we can find $\QTR{Large}{d}$ such that MATH. Note that $\QTR{Large}{e}$ and $\QTR{Large}{d}$ are "symmetric" for two way communication.

4. Here is RSA

Note: d MATH(e MATH(M)) $\fallingdotseq $ M MATH M MATH (M MATH) $^{\QTR{Large}{a}}$M $\fallingdotseq $ (1) $^{\QTR{Large}{a}}$M $\fallingdotseq $ M

And d MATH(e MATH(M))=M.

Example- Let $\QTR{Large}{p=47}$ and $\QTR{Large}{q=53}$. MATH

$\vspace{1pt}$

MATH and MATH. So MATH. Choose $\QTR{Large}{e=35} $. Note MATH

$\vspace{1pt}$

Compute MATH

$\vspace{1pt}$

Suppose M $\QTR{Large}{=25}$ $\ $Check MATH

$\vspace{1pt}$

----------------------------------------------------------------------------------------------------------

If your pocket calculator is not working try:

$\vspace{1pt}$

import java.util.*;

import java.math.*;

public class Calcmod {

public static void main(String[] args)

{

try

{

BigInteger p=new BigInteger("48112959837082048697"); //I looked these two primes up (see TOC for this section)

BigInteger q=new BigInteger("36413321723440003717");

BigInteger n=new BigInteger("0");

n=p.multiply(q);

BigInteger pm1qm1= new BigInteger("0");

pm1qm1=(p.subtract(new BigInteger("1"))).multiply(q.subtract(new BigInteger("1")));

System.out.println("n="+n);

System.out.println("(p-1)(q-1)="+pm1qm1);

BigInteger e=new BigInteger("67843189741225"); //Chosen at random, sort of......

BigInteger d=new BigInteger("0");

d=e.modInverse(pm1qm1);

System.out.println("e="+e+" d="+d);

//HELLO=7269767679

BigInteger Message=new BigInteger("7269767679");

System.out.println("Message='HELLO' as decimal ascii= "+Message);

BigInteger code=Message.modPow(e,n);

System.out.println("Message ^e=coded="+code);

BigInteger result=code.modPow(d,n); // Message.modPow(e.multiply(d),n);

System.out.println("Message ^(ed) MOD mod = Message?");

System.out.println(result);

}

catch (Exception ex){ ex.printStackTrace();}

}//main

} //Calcmod

THE OUTPUT

n=1751952685614616185916001760791655006749

(p-1)(q-1)=1751952685614616185831475479231132954336

e=67843189741225 d=346820212054753766339618442769730365753

Message='HELLO' as decimal ascii= 7269767679

Message ^e=coded=195102718882357445246760445462165944439

Message ^(ed) MOD mod = Message?

7269767679

Observation: At first glance there may appear to be a security opening in RSA. A reasonable question that could be asked is, while it may be hard to factor $\QTR{Large}{n}$ all we really need to do is find $\QTR{Large}{d}$ such that MATH, so given, MATH, is there a way to compute MATH?

The answer is that it is as "hard" to compute MATH from $\QTR{Large}{n}$ as it is to factor $\QTR{Large}{n}$ it self. Here is the argument.

1. For the sake of clarity, set MATH. So if we know $\QTR{Large}{p}$ and $\QTR{Large}{q}$ we can quickly compute $\QTR{Large}{m}$.

Next the important direction.

2. Suppose there was an easy way to compute $\QTR{Large}{m}$ from $\QTR{Large}{n}$. To factor $\QTR{Large}{n}$, we would then only have to solve the two simultaneous equations.

MATH

MATH

in two unknowns $\QTR{Large}{p}$ and $\QTR{Large}{q}$.

Solving the first equation for p gives.

MATH

substituting this into the second equation gives.

MATH

or

MATH.

The quadratic formula does the rest.