RSA

toy example

type in bit size for randomization (e.g. 32 or 128):  

secret key and public key

type in secret primenumber keys p and q or click for random prime numbers (DO type in primes if you prefer to use your own p and q - or else..)
p:  
q:  
Generate an e with gcd(e,(p-1)*(q-1))=1. (relative prime to phi), N= p*q, phi=(p-1)*(q-1)



e: 
 
N:

phi:
Public keys are N and e - to be published

Encryption


type in message
m:   (just numbers in this version)  
calculate encrypted message c:
:

c:

Decryption



calculate d = e^-1 mod phi   
d:

calculate message: c^d mod N:  
m:



Based on statistical valid primes, and on a hope that the primes will be found before the end of the universe or before the end of the life of the computer - what ever comes first.Can use up to 999 bits Miller Rabin tested probably primes
Randomness by RNGCryptoServiceProvider.
be sure to fill out required fields - no exeptions handling here (yet)
disclamer: Not suitable for professional use, not optimized for industrial strength, only for educational  and illustrational purpose
contact: c h r i s t e l @ c h r i s t e l . d k