You are on page 1of 14

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 jibberish1

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.
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.

Disadvantages:

RSA Public-Key Cryptography

Named after the inventors, Ron Rivest, Adi Shamir, and Len Adleman 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 = me 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 = cd mod n
where m = the test answers Bob sent to Alice c = the ciphertext of the message, d = Alices private key, n = pq (the modulus).

Bob

Alice

n=p*q
Test Answers (M) Test Answers (M)

Me % n

Alices Public Key (e, n)

Cd % n

Alices Private Key (d)

transmission Ciphertext (c) Ciphertext (c)

Mathematical

2 Example

Lets 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) = me mod n = m17 mod 3233 where m is the plaintext. The decryption function is: decrypt(c) = cd mod n = c2753 mod 3233 where c is the ciphertext. To encrypt the plaintext value 123, we calculate encrypt(123) = 12317 mod 3233 = 855 To decrypt the ciphertext value 855, we calculate decrypt(855) = 8552753 mod 3233 = 123

Digital Signature
n=p*q
Hash (M) Bobs Private Key (d) Hash (M) ==
Decrypt with Bobs public key

Digital Signature + Test Answers (M)

Alices Public Key (e, n)

M + Digital Signature

Alices Private Key (d)

decrypt

Ciphertext (c)

Ciphertext (c)

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.