Date post: | 24-Jan-2017 |
Category: |
Devices & Hardware |
Upload: | annalisa-di-pierro |
View: | 55 times |
Download: | 1 times |
RSARonald Rivest
Adi ShamirLeonard Adleman
What is RSA?
RSA is an asymmetric encryption algorithm, invented by three researchers of MIT:
Ronald Rivest Adi Shamir Leonard Adleman
How does it work?Any user wants to use RSA, must create two Keys:
Public Key, anyone can see this Key.
Private Key, only the owner can see this Key.
How does it work?
If A wants to send a message to B, can use two methods.
A B
First Method
A B
Original File Original FileEncrypted FileEncrypt Decrypt
1. A, encrypts his message with his private key;2. B, decrypts the message with the public key of A.
Private Key of A Public Key of A
Second Method
A B
Original File Original FileEncrypted FileEncrypt Decrypt
1. A, encrypts his message with the public key of B;2. B, decrypts the message with his private key.
Public Key of B Private Key of B
Generate the KeysTo generate the keys we need to follow these steps:
1.Choose two prime numbers A and B;2.Calculate N = A * B;3.Calculate Z = (A – 1) * (B – 1);4.Choose a private key (It mustn't have common factors with Z and must be less than Z);
5.Calculate the public key knowing that (Private Key * Public Key) mod Z = 1.
Generate the KeysChoose two prime number s A and B:
A = 11B = 17
Calculate N = A * B:
N = A * B = 11 * 17 = 187
Calculate Z = (A – 1) * (B – 1):
Z = (A – 1) * (B – 1) = (11 – 1) * (17 – 1) = 10 * 16 = 160
Generate the KeysChoose a private key (It mustn't have common factors with Z and must be less than Z):
Private Key = 3
Calculate the public key knowing that (Private Key * Public Key) mod Z = 1:
(3 * Public Key) mod 160 = 1Public Key = 107
Public Key = (107, 187)Private Key = (3, 187)
Encrypt a MessageTo encrypt a message, I must choose an alphabet, like this:
and then encrypt a message with the FIRST METHOD (Encrypt with the private key of A and decrypt with the public key of A)…
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
ClearText M M3 mod 187S 19 127I 9 168S 19 127T 20 146E 5 125M 13 140I 9 168
Decrypt a MessageTo Encrypt a message I used the FIRST METHOD of encryption, so, I must decrypt the message with the public key of A:
Encrypted Text (C) C107 mod 187 Decrypted Text127 19 S168 9 I127 19 S146 20 T125 5 E140 13 M168 9 I
RSA
Thanks for watching
Francesco Vibert 5INF