Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE MUST BE WRITTEN IN PYTHON 3! We are going to code a very basic implementation of the Key Generation algorithm for RSA. The input

CODE MUST BE WRITTEN IN PYTHON 3! image text in transcribed
We are going to code a very basic implementation of the Key Generation algorithm for RSA. The input into GenerateRSAKey is k, the size of the modulus in bits, and the output is p, q, factors of the modulus n, the modulus d3, the signing exponent d5, the decryption exponent. Psuedocode: Check for a sensible range. assert 64 lessthanorequalto k lessthanorequalto 128 Generate the primes. P leftarrow GenerateRSAPrime ([k/2]) q leftarrow GenerateRSAPrime([k/2]) Compute the LCM of p-1 and q - 1 t leftarrow (p - 1) (q - 1)/GCD(p-1, q-1) Compute the secret key exponents using the modular inversion feature of the extended GCD algorithm. g, (u, v) leftarrow ExtendedGCD(3, t) Check that the GCD is correct. assert g = 1 Reduce u modulo t d_3 = u mod t Repeat for dS g, (u, v) leftarrow ExtendedGCD(5, t) assert g = 1 d5 = u mod t return p, q, pq, d3, d5 We are going to code a very basic implementation of the Key Generation algorithm for RSA. The input into GenerateRSAKey is k, the size of the modulus in bits, and the output is p, q, factors of the modulus n, the modulus d3, the signing exponent d5, the decryption exponent. Psuedocode: Check for a sensible range. assert 64 lessthanorequalto k lessthanorequalto 128 Generate the primes. P leftarrow GenerateRSAPrime ([k/2]) q leftarrow GenerateRSAPrime([k/2]) Compute the LCM of p-1 and q - 1 t leftarrow (p - 1) (q - 1)/GCD(p-1, q-1) Compute the secret key exponents using the modular inversion feature of the extended GCD algorithm. g, (u, v) leftarrow ExtendedGCD(3, t) Check that the GCD is correct. assert g = 1 Reduce u modulo t d_3 = u mod t Repeat for dS g, (u, v) leftarrow ExtendedGCD(5, t) assert g = 1 d5 = u mod t return p, q, pq, d3, d5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

=+j Explain the litigation risks in international labor relations.

Answered: 1 week ago

Question

=+j What rules will apply to the process of negotiations?

Answered: 1 week ago