• Tidak ada hasil yang ditemukan

Week 12 - Algoritma RSA 1

N/A
N/A
nicesuu

Academic year: 2023

Membagikan "Week 12 - Algoritma RSA 1"

Copied!
4
0
0

Teks penuh

(1)

Week 12_Algoritma RSA 1

7.1. RSA algorithm step by step example

Public & Private Key

RSA relies on a concept of Public & Private key Asymmetric encoding and decoding

Public key is used to encrypt the message Private key is used to decrypt the message

Asymmetric Encryption

gpg Gnu Privacy Guard)⟶ open source tool for encrypting files.

The gpg --gen-key command is used to generate a new cryptographic key pair for use with GPG GNU Privacy Guard).

This key pair consists of a public key and a corresponding private key.

The Public Key

When you run the program, you would get something like this.

You create a public key with the encryption software.

Send this key to your friends via 1 email

2 website

 Your friend imports your public key into the GPG encryption software.

 He/she runs the encryption software on the secret message.

 This generates an encryption file.

(2)

 Your friend attaches or copies the encrypted message to a regular email message.

 The public key cannot be used to decrypt the message.

The Private Key

 You run the decryption software on your computer to open the message.

 You must have the private key file on your computer and know the private key's password.

Factors Examples

RSA relies on the idea of factoring large numbers.

What are the factors of 12?

1 12 2 6 3 4

What are the factors of 35?

1 35

5 7 (two prime numbers! Secret to making encryption work!

RSA encryption relies on factors and large prime numbers

Choose two prime numbers: 31 and 37 What is 31 37? 1147 (easy problem to solve)

What are all the factors of 1147? (much harder to solve) What are the factors of 414,863? little bit more difficult

What are the factors of 1,081,881,451,307,197,929,383? Now we're beyond the reach of what your computer can calculate in a short amount of time

How to make a public RSA key

e stand for encryption d stand for decryption

That's really the essence, find a really difficult prime number factoring problem, and keep half of it secret (N and d).

Simple Example

gpg -d encrypted.txt.as

(3)

Choose two prime numbers, p 2, q 7 N 2 7 14

Euler Totient or ϕ T (p-1) x (q-1)

= 2 1 x 7 1 1 6 6

Choose e and d where (e ⋅ d) mod T 1 (e ⋅ d) mod 6 1

Must be less than T.

Must be coprime with T and N.

What is coprime? two numbers are considered coprime if their greatest common divisor GCD is 1.

I don't want the same key to be used in both e and d, so I'm going to choose 11.

The larger number you pick apparently it's more complex.

e 5, d 11 Public key is 5, 14 Private key is 11, 14

How to encrypt a message

The public key is 5, 14 . From previous slide.

Let's send a one-letter secret message "B".

Instead of "B", let's use the number 2.

A 1, B 2, C 3 etc.

Encryption value = 25 mod 14

2 2 is the secret message, the thing that's going to be encrypted.

5 first part of the public key.

14 second part of the public key.

25 32 32 mod 14 4 32 / 28 4

4 is the encrypted message.

Translated to letter "D"

How to decrypt a message

The public key is 5, 14 . From previous slide.

(4)

We need to know the private key in order to decrypt 11, 14 The secrete message is "D".

Instead of "D" (encoded message), let's translate that to the number 4.

A 1, B 2, C 3 etc.

Decrypted value = 411 mod 14 4 the letter "D"

11 first part of private key 411 4194304

4193304/14 299593,142857143 take the decimal part only 0,142857143 14 2,000000002

2 is the encrypted message.

Translated to letter "B".

Referensi

Dokumen terkait