Public-Key Encryption by RSA Algorithm
The purpose of this page is to demonstrate step by step how a public-key encryption system
We use the RSA algorithm (named after the inventors Rivest, Shamir, Adleman) with very small primes. The basic functions are
Note: This page is only for explaining the mechanism. In practice
more advanced algorithms und much larger primes are used!
(Idea and most code taken from a no more existing student's page at
University Honors College (Oregon State),
a more realistic demo-implementation can be found here. This page copied 3/16/06 from http://www.profactor.at/~wstoec/rsa.html)
Working with a public-key encryption system has mainly three phases:
- Key Generation: Whoever wants to receive secret messages creates a public key
(which is published) and a private key (kept secret).
The keys are generated in a way that conceals their construction and
makes it 'difficult' to find the private key by only knowing the public key.
- Encryption: A secret message to any person can be encrypted
by his/her public key (that could be officially listed like phone numbers).
- Decryption: Only the person being addressed can easily
decrypt the secret message using the private key.
RSA Key Generation
From two selected primes the computer will generate the public
and the private key: