<s>
RSA	B-Architecture
(	O
Rivest	B-Architecture
–	I-Architecture
Shamir	I-Architecture
–	I-Architecture
Adleman	I-Architecture
)	O
is	O
a	O
public-key	B-Application
cryptosystem	I-Application
that	O
is	O
widely	O
used	O
for	O
secure	O
data	O
transmission	O
.	O
</s>
<s>
The	O
acronym	O
"	O
RSA	B-Architecture
"	O
comes	O
from	O
the	O
surnames	O
of	O
Ron	O
Rivest	O
,	O
Adi	O
Shamir	O
and	O
Leonard	O
Adleman	O
,	O
who	O
publicly	O
described	O
the	O
algorithm	O
in	O
1977	O
.	O
</s>
<s>
In	O
a	O
public-key	B-Application
cryptosystem	I-Application
,	O
the	O
encryption	O
key	O
is	O
public	O
and	O
distinct	O
from	O
the	O
decryption	O
key	O
,	O
which	O
is	O
kept	O
secret	O
(	O
private	O
)	O
.	O
</s>
<s>
An	O
RSA	B-Architecture
user	O
creates	O
and	O
publishes	O
a	O
public	B-Application
key	I-Application
based	O
on	O
two	O
large	O
prime	O
numbers	O
,	O
along	O
with	O
an	O
auxiliary	O
value	O
.	O
</s>
<s>
Messages	O
can	O
be	O
encrypted	O
by	O
anyone	O
,	O
via	O
the	O
public	B-Application
key	I-Application
,	O
but	O
can	O
only	O
be	O
decoded	O
by	O
someone	O
who	O
knows	O
the	O
prime	O
numbers	O
.	O
</s>
<s>
The	O
security	O
of	O
RSA	B-Architecture
relies	O
on	O
the	O
practical	O
difficulty	O
of	O
factoring	O
the	O
product	O
of	O
two	O
large	O
prime	O
numbers	O
,	O
the	O
"	O
factoring	O
problem	O
"	O
.	O
</s>
<s>
Breaking	O
RSA	B-Architecture
encryption	I-Architecture
is	O
known	O
as	O
the	O
RSA	B-Architecture
problem	O
.	O
</s>
<s>
RSA	B-Architecture
is	O
a	O
relatively	O
slow	O
algorithm	O
.	O
</s>
<s>
More	O
often	O
,	O
RSA	B-Architecture
is	O
used	O
to	O
transmit	O
shared	B-Algorithm
keys	I-Algorithm
for	O
symmetric-key	B-Algorithm
cryptography	I-Algorithm
,	O
which	O
are	O
then	O
used	O
for	O
bulk	O
encryption	O
–	O
decryption	O
.	O
</s>
<s>
The	O
idea	O
of	O
an	O
asymmetric	O
public-private	O
key	O
cryptosystem	B-General_Concept
is	O
attributed	O
to	O
Whitfield	O
Diffie	O
and	O
Martin	O
Hellman	O
,	O
who	O
published	O
this	O
concept	O
in	O
1976	O
.	O
</s>
<s>
Their	O
formulation	O
used	O
a	O
shared-secret-key	O
created	O
from	O
exponentiation	O
of	O
some	O
number	O
,	O
modulo	O
a	O
prime	O
number	O
.	O
</s>
<s>
They	O
tried	O
many	O
approaches	O
,	O
including	O
"	O
knapsack-based	O
"	O
and	O
"	O
permutation	O
polynomials	O
"	O
.	O
</s>
<s>
The	O
algorithm	O
is	O
now	O
known	O
as	O
RSA	B-Architecture
the	O
initials	O
of	O
their	O
surnames	O
in	O
same	O
order	O
as	O
their	O
paper	O
.	O
</s>
<s>
Kid-RSA	O
(	O
KRSA	O
)	O
is	O
a	O
simplified	O
,	O
insecure	O
public-key	B-Application
cipher	O
published	O
in	O
1997	O
,	O
designed	O
for	O
educational	O
purposes	O
.	O
</s>
<s>
Some	O
people	O
feel	O
that	O
learning	O
Kid-RSA	O
gives	O
insight	O
into	O
RSA	B-Architecture
and	O
other	O
public-key	B-Application
ciphers	O
,	O
analogous	O
to	O
simplified	O
DES	O
.	O
</s>
<s>
A	O
patent	O
describing	O
the	O
RSA	B-Architecture
algorithm	I-Architecture
was	O
granted	O
to	O
MIT	O
on	O
20	O
September	O
1983	O
:	O
"	O
Cryptographic	O
communications	O
system	O
and	O
method	O
"	O
.	O
</s>
<s>
From	O
DWPI	B-Library
's	O
abstract	O
of	O
the	O
patent	O
:	O
</s>
<s>
The	O
patent	O
was	O
about	O
to	O
expire	O
on	O
21	O
September	O
2000	O
,	O
but	O
RSA	B-Architecture
Security	O
released	O
the	O
algorithm	O
to	O
the	O
public	O
domain	O
on	O
6	O
September	O
2000	O
.	O
</s>
<s>
The	O
RSA	B-Architecture
algorithm	I-Architecture
involves	O
four	O
steps	O
:	O
key	O
generation	O
,	O
key	O
distribution	O
,	O
encryption	O
,	O
and	O
decryption	O
.	O
</s>
<s>
A	O
basic	O
principle	O
behind	O
RSA	B-Architecture
is	O
the	O
observation	O
that	O
it	O
is	O
practical	O
to	O
find	O
three	O
very	O
large	O
positive	O
integers	O
,	O
,	O
and	O
,	O
such	O
that	O
with	O
modular	O
exponentiation	O
for	O
all	O
integers	O
(	O
with	O
)	O
:	O
</s>
<s>
RSA	B-Architecture
involves	O
a	O
public	B-Application
key	I-Application
and	O
a	O
private	B-Application
key	I-Application
.	O
</s>
<s>
The	O
public	B-Application
key	I-Application
can	O
be	O
known	O
by	O
everyone	O
and	O
is	O
used	O
for	O
encrypting	O
messages	O
.	O
</s>
<s>
The	O
intention	O
is	O
that	O
messages	O
encrypted	O
with	O
the	O
public	B-Application
key	I-Application
can	O
only	O
be	O
decrypted	O
in	O
a	O
reasonable	O
amount	O
of	O
time	O
by	O
using	O
the	O
private	B-Application
key	I-Application
.	O
</s>
<s>
The	O
public	B-Application
key	I-Application
is	O
represented	O
by	O
the	O
integers	O
and	O
,	O
and	O
the	O
private	B-Application
key	I-Application
by	O
the	O
integer	O
(	O
although	O
is	O
also	O
used	O
during	O
the	O
decryption	O
process	O
,	O
so	O
it	O
might	O
be	O
considered	O
to	O
be	O
a	O
part	O
of	O
the	O
private	B-Application
key	I-Application
too	O
)	O
.	O
</s>
<s>
The	O
keys	O
for	O
the	O
RSA	B-Architecture
algorithm	I-Architecture
are	O
generated	O
in	O
the	O
following	O
way	O
:	O
</s>
<s>
For	O
choosing	O
them	O
the	O
standard	O
method	O
is	O
to	O
choose	O
random	O
integers	O
and	O
use	O
a	O
primality	B-Algorithm
test	I-Algorithm
until	O
two	O
primes	O
are	O
found	O
.	O
</s>
<s>
is	O
used	O
as	O
the	O
modulus	O
for	O
both	O
the	O
public	O
and	O
private	B-Application
keys	I-Application
.	O
</s>
<s>
is	O
released	O
as	O
part	O
of	O
the	O
public	B-Application
key	I-Application
.	O
</s>
<s>
Compute	O
,	O
where	O
is	O
Carmichael	B-Algorithm
's	I-Algorithm
totient	I-Algorithm
function	I-Algorithm
.	O
</s>
<s>
having	O
a	O
short	O
bit-length	B-Algorithm
and	O
small	O
Hamming	O
weight	O
results	O
in	O
more	O
efficient	O
encryption	O
the	O
most	O
commonly	O
chosen	O
value	O
for	O
is	O
.	O
</s>
<s>
is	O
released	O
as	O
part	O
of	O
the	O
public	B-Application
key	I-Application
.	O
</s>
<s>
is	O
kept	O
secret	O
as	O
the	O
private	B-Application
key	I-Application
exponent	O
.	O
</s>
<s>
The	O
public	B-Application
key	I-Application
consists	O
of	O
the	O
modulus	O
and	O
the	O
public	O
(	O
or	O
encryption	O
)	O
exponent	O
.	O
</s>
<s>
The	O
private	B-Application
key	I-Application
consists	O
of	O
the	O
private	O
(	O
or	O
decryption	O
)	O
exponent	O
,	O
which	O
must	O
be	O
kept	O
secret	O
.	O
</s>
<s>
In	O
the	O
original	O
RSA	B-Architecture
paper	O
,	O
the	O
Euler	O
totient	O
function	O
is	O
used	O
instead	O
of	O
for	O
calculating	O
the	O
private	O
exponent	O
.	O
</s>
<s>
Most	O
of	O
the	O
implementations	O
of	O
RSA	B-Architecture
will	O
accept	O
exponents	O
generated	O
using	O
either	O
method	O
(	O
if	O
they	O
use	O
the	O
private	O
exponent	O
at	O
all	O
,	O
rather	O
than	O
using	O
the	O
optimized	O
decryption	O
method	O
based	O
on	O
the	O
Chinese	O
remainder	O
theorem	O
described	O
below	O
)	O
,	O
but	O
some	O
standards	O
such	O
as	O
may	O
require	O
that	O
.	O
</s>
<s>
Note	O
:	O
The	O
authors	O
of	O
the	O
original	O
RSA	B-Architecture
paper	O
carry	O
out	O
the	O
key	O
generation	O
by	O
choosing	O
and	O
then	O
computing	O
as	O
the	O
modular	O
multiplicative	O
inverse	O
of	O
modulo	O
,	O
whereas	O
most	O
current	O
implementations	O
of	O
RSA	B-Architecture
,	O
such	O
as	O
those	O
following	O
PKCS	O
#1	O
,	O
do	O
the	O
reverse	O
(	O
choose	O
and	O
compute	O
)	O
.	O
</s>
<s>
Since	O
the	O
chosen	O
key	O
can	O
be	O
small	O
,	O
whereas	O
the	O
computed	O
key	O
normally	O
is	O
not	O
,	O
the	O
RSA	B-Architecture
paper	O
's	O
algorithm	O
optimizes	O
decryption	O
compared	O
to	O
encryption	O
,	O
while	O
the	O
modern	O
algorithm	O
optimizes	O
encryption	O
instead	O
.	O
</s>
<s>
If	O
they	O
decide	O
to	O
use	O
RSA	B-Architecture
,	O
Bob	O
must	O
know	O
Alice	O
's	O
public	B-Application
key	I-Application
to	O
encrypt	O
the	O
message	O
,	O
and	O
Alice	O
must	O
use	O
her	O
private	B-Application
key	I-Application
to	O
decrypt	O
the	O
message	O
.	O
</s>
<s>
To	O
enable	O
Bob	O
to	O
send	O
his	O
encrypted	O
messages	O
,	O
Alice	O
transmits	O
her	O
public	B-Application
key	I-Application
to	O
Bob	O
via	O
a	O
reliable	O
,	O
but	O
not	O
necessarily	O
secret	O
,	O
route	O
.	O
</s>
<s>
Alice	O
's	O
private	B-Application
key	I-Application
is	O
never	O
distributed	O
.	O
</s>
<s>
After	O
Bob	O
obtains	O
Alice	O
's	O
public	B-Application
key	I-Application
,	O
he	O
can	O
send	O
a	O
message	O
to	O
Alice	O
.	O
</s>
<s>
To	O
do	O
it	O
,	O
he	O
first	O
turns	O
(	O
strictly	O
speaking	O
,	O
the	O
un-padded	O
plaintext	O
)	O
into	O
an	O
integer	O
(	O
strictly	O
speaking	O
,	O
the	O
padded	B-Algorithm
plaintext	O
)	O
,	O
such	O
that	O
by	O
using	O
an	O
agreed-upon	O
reversible	O
protocol	O
known	O
as	O
a	O
padding	B-Algorithm
scheme	I-Algorithm
.	O
</s>
<s>
Given	O
,	O
she	O
can	O
recover	O
the	O
original	O
message	O
by	O
reversing	O
the	O
padding	B-Algorithm
scheme	I-Algorithm
.	O
</s>
<s>
Here	O
is	O
an	O
example	O
of	O
RSA	B-Architecture
encryption	I-Architecture
and	O
decryption	O
.	O
</s>
<s>
The	O
parameters	O
used	O
here	O
are	O
artificially	O
small	O
,	O
but	O
one	O
can	O
also	O
use	O
OpenSSL	B-Language
to	O
generate	O
and	O
examine	O
a	O
real	O
keypair	B-Application
.	O
</s>
<s>
The	O
public	B-Application
key	I-Application
is	O
.	O
</s>
<s>
The	O
private	B-Application
key	I-Application
is	O
.	O
</s>
<s>
Both	O
of	O
these	O
calculations	O
can	O
be	O
computed	O
efficiently	O
using	O
the	O
square-and-multiply	B-Algorithm
algorithm	I-Algorithm
for	O
modular	O
exponentiation	O
.	O
</s>
<s>
In	O
real-life	O
situations	O
the	O
primes	O
selected	O
would	O
be	O
much	O
larger	O
;	O
in	O
our	O
example	O
it	O
would	O
be	O
trivial	O
to	O
factor	O
(	O
obtained	O
from	O
the	O
freely	O
available	O
public	B-Application
key	I-Application
)	O
back	O
to	O
the	O
primes	O
and	O
.	O
</s>
<s>
,	O
also	O
from	O
the	O
public	B-Application
key	I-Application
,	O
is	O
then	O
inverted	O
to	O
get	O
,	O
thus	O
acquiring	O
the	O
private	B-Application
key	I-Application
.	O
</s>
<s>
The	O
values	O
,	O
and	O
,	O
which	O
are	O
part	O
of	O
the	O
private	B-Application
key	I-Application
are	O
computed	O
as	O
follows	O
:	O
</s>
<s>
Suppose	O
Alice	O
uses	O
Bob	O
's	O
public	B-Application
key	I-Application
to	O
send	O
him	O
an	O
encrypted	O
message	O
.	O
</s>
<s>
In	O
the	O
message	O
,	O
she	O
can	O
claim	O
to	O
be	O
Alice	O
,	O
but	O
Bob	O
has	O
no	O
way	O
of	O
verifying	O
that	O
the	O
message	O
was	O
from	O
Alice	O
,	O
since	O
anyone	O
can	O
use	O
Bob	O
's	O
public	B-Application
key	I-Application
to	O
send	O
him	O
encrypted	O
messages	O
.	O
</s>
<s>
In	O
order	O
to	O
verify	O
the	O
origin	O
of	O
a	O
message	O
,	O
RSA	B-Architecture
can	O
also	O
be	O
used	O
to	O
sign	O
a	O
message	O
.	O
</s>
<s>
She	O
can	O
use	O
her	O
own	O
private	B-Application
key	I-Application
to	O
do	O
so	O
.	O
</s>
<s>
She	O
produces	O
a	O
hash	B-Algorithm
value	I-Algorithm
of	O
the	O
message	O
,	O
raises	O
it	O
to	O
the	O
power	O
of	O
(	O
modulo	O
)	O
(	O
as	O
she	O
does	O
when	O
decrypting	O
a	O
message	O
)	O
,	O
and	O
attaches	O
it	O
as	O
a	O
"	O
signature	O
"	O
to	O
the	O
message	O
.	O
</s>
<s>
When	O
Bob	O
receives	O
the	O
signed	O
message	O
,	O
he	O
uses	O
the	O
same	O
hash	B-Algorithm
algorithm	O
in	O
conjunction	O
with	O
Alice	O
's	O
public	B-Application
key	I-Application
.	O
</s>
<s>
He	O
raises	O
the	O
signature	O
to	O
the	O
power	O
of	O
(	O
modulo	O
)	O
(	O
as	O
he	O
does	O
when	O
encrypting	O
a	O
message	O
)	O
,	O
and	O
compares	O
the	O
resulting	O
hash	B-Algorithm
value	I-Algorithm
with	O
the	O
message	O
's	O
hash	B-Algorithm
value	I-Algorithm
.	O
</s>
<s>
If	O
the	O
two	O
agree	O
,	O
he	O
knows	O
that	O
the	O
author	O
of	O
the	O
message	O
was	O
in	O
possession	O
of	O
Alice	O
's	O
private	B-Application
key	I-Application
and	O
that	O
the	O
message	O
has	O
not	O
been	O
tampered	O
with	O
since	O
being	O
sent	O
.	O
</s>
<s>
Thus	O
the	O
keys	O
may	O
be	O
swapped	O
without	O
loss	O
of	O
generality	O
,	O
that	O
is	O
,	O
a	O
private	B-Application
key	I-Application
of	O
a	O
key	B-Application
pair	I-Application
may	O
be	O
used	O
either	O
to	O
:	O
</s>
<s>
Decrypt	O
a	O
message	O
only	O
intended	O
for	O
the	O
recipient	O
,	O
which	O
may	O
be	O
encrypted	O
by	O
anyone	O
having	O
the	O
public	B-Application
key	I-Application
(	O
asymmetric	O
encrypted	O
transport	O
)	O
.	O
</s>
<s>
The	O
proof	O
of	O
the	O
correctness	O
of	O
RSA	B-Architecture
is	O
based	O
on	O
Fermat	O
's	O
little	O
theorem	O
,	O
stating	O
that	O
for	O
any	O
integer	O
and	O
prime	O
,	O
not	O
dividing	O
.	O
</s>
