RSA Cryptography
Kiera Caponi
Larissa Grayson
Cryptography Terms
Cryptography
–
The practice and study of encryption
and decryption
–
encoding data so that it can only
be encoded by specific individuals.
Cryptosystem
–
system for encrypting and
decrypting data. Security of cryptosystem depends
on secrecy of the keys rather than the secrecy of the
algorithm. It is important to have a large range of
possible keys, so that it is not possible to do a “brute
force” approach in cracking the algorithm.
Plaintext
–
Unencrypted data.
Ciphertext
–
Encrypted data. “unreadable jibberish”
1
How Cryptography Works
Uses cryptographic algorithms called
“ciphers” and “deciphers.” Mathematical
functions that work with cryptographic
keys to encrypt and decrypt plaintext.
The larger the “key,” the more secure the
ciphertext.
The same plaintext encrypts to different
ciphertexts using different keys.
Public Key Cryptography
Traditionally, cryptography was done with just a secret key,
which would have to be known to everyone, and this was
insecure.
The challenge would be that parties would have to agree on a
secret key without anyone else finding out.
The secret key method is generally faster, but less secure.
The public key cryptosystem was introduced in 1976 by
Whitfield Diffie and Martin Hellman.
Uses public key for encryption, as well as a private key for
decryption.
Each user gets two keys: one public and one private. The public
key is published; the private key is secret. This eliminates the
need to share the private key.
Private key is always linked mathematically to the public key. If
the system, is hacked, then the secret key can be found.
The solution is to make it so that the hacker has to factor a very
large number to get the private key, so that it would become
“computationally infeasible” to perform the derivation.
Advantages and Disadvantages
of Public Key Cryptography
Advantages:
Increased security and convenience.
Provides digital signatures that cannot be
repudiated.
Disadvantages:
Slower than secret key method, but can be
used in conjunction with the secret key to
make it more efficient.
Can be vulnerable to impersonation if hacked.
RSA Public

Key Cryptography
Named after the inventors, Ron
R
ivest, Adi
S
hamir, and Len
A
dleman in 1977.
One of the interesting things about RSA is that
you can tell anyone about how the encryption
works; however, this knowledge is not sufficient
to be able to decrypt the ciphertext. Only the
chosen few who have extra information can
decrypt the message.
Computing the RSA Public Key
RSA public key:
Modulus
(also called
n
): The product of two
large, odd, prime numbers
p
and
q
, of about
the same size. Therefore,
n
=
pq
.
Exponent
(
e
): 3 <
e
<
n
and
e
and (
p
–
1)(
q
–
1) have not
common factors except 1 (ie.
e
is relatively
prime to
(
p
–
1)(
q
–
1)
).
RSA Private key
d
:
Number
d
such that
(
ed
–
1)
is divisible
by
(
p
–
1)(
q
–
1)
.
Meet Alice & Bob
Bob wants to send Alice the test answers
without Professor Eve knowing. Bob decides to
use RSA cryptography to send Alice his
message. Bob encrypts his message by
performing the following formula:
c
=
m
e
mod
n
where
c
= ciphertext,
m
= message,
e
=
exponent
, n
= modulus (ie.
pq
)
Alice receives the ciphertext
c
, and
needs to decrypt it using the following
formula:
m
=
c
d
mod
n
where
m
= the test answers Bob sent to Alice
c
= the ciphertext of the message,
d
= Alice’s
private key,
n
=
pq
(the modulus).
Bob
Alice
Test Answers (M)
Test Answers (M)
M
e
% n
Alice’s
Public Key
(e, n)
Ciphertext (c)
Ciphertext (c)
C
d
% n
Alice’s
Private Key
(d)
transmission
n = p * q
Mathematical Example
2
Let’s say that. . .
p
= 61
—
first prime number (to be kept secret or deleted securely)
q
= 53
—
second prime number (to be kept secret or deleted securely)
n
=
pq
= 3233
—
modulus (to be made public)
e
= 17
—
public exponent (to be made public)
d
= 2753
—
private exponent (to be kept secret)
The
encryption function
is:
encrypt(
m
) =
m
e
mod
n
=
m
17
mod 3233
where
m
is the plaintext.
The
decryption function
is:
decrypt(
c
) =
c
d
mod
n
=
c
2753
mod 3233
where
c
is the ciphertext.
To
encrypt the plaintext
value 123, we calculate
encrypt(123) = 123
17
mod 3233 = 855
To
decrypt the ciphertext
value 855, we calculate
decrypt(855) = 855
2753
mod 3233 = 123
Digital Signature
Hash (M)
Alice’s
Public Key
(e, n)
Ciphertext (c)
Ciphertext (c)
decrypt
Alice’s
Private Key
(d)
n = p * q
Digital Signature
+
Test Answers (M)
Bob’s
Private
Key (d)
M + Digital
Signature
Decrypt with Bob’s
public key
Hash (M) ==
Padding
RSA is usually combined with a padding scheme in
order to make sure the message
m
never has an
insecure ciphertext.
RSA implementations typically embed some form of
structured, randomized padding into the message
m
before encrypting it. This will ensure that it does not
fall into the range of insecure plaintexts.
The padded encryption can have a large number of
possible ciphertexts, thus decreasing the risk of an
attacker building a dictionary by encrypting likely
plaintexts under the public key and storing the
resulting ciphertexts. When matching ciphertexts are
observed on a communication channel, the attacker
can use this dictionary in order to learn the content of
the message.
2
References
1
http://www.codeproject.com/dotnet/RSACryptoPad.asp
2
http://en.wikipedia.org/wiki/Rsa
Cormen, Leiserson, Rivest, Stein.
Introduction to
Algorithms
. McGraw

Hill.
Comments 0
Log in to post a comment