Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For RSA, how do i calculate the secret exponent?

For RSA, how do i calculate the secret exponent?

Given p and q the two primes, and phi=(p-1)(q-1), and the public exponent (0x10001), how do i get the secret exponent 'd' ?

I've read that i have to do: d = e-1 mod phi using modular inversion and the euclidean equation but i cannot understand how the above formula maps to either the a-1 ≡ x mod m formula on the modular inversion wiki page, or how it maps to the euclidean GCD equation.

Can someone help please, cheers

like image 828
Chris Avatar asked Jul 09 '10 03:07

Chris


People also ask

What is the exponent in terms of the RSA algorithm?

The public key of an RSA public/private pair consists of an exponent and a modulus, whether it's being used to sign or encrypt. The most common exponent is 0x10001.

How is the private key calculated in RSA algorithm?

RSA algorithm uses the following procedure to generate public and private keys: Select two large prime numbers, p and q. Multiply these numbers to find n = p x q, where n is called the modulus for encryption and decryption. If n = p x q, then the public key is <e, n>.

How is e and D calculated in RSA?

OUTPUT: An RSA key pair ((N,e),d) where N is the modulus, the product of two primes (N=pq) not exceeding k bits in length; e is the public exponent, a number less than and coprime to (p−1)(q−1); and d is the private exponent such that ed≡1mod(p−1)(q−1).

How do you find N and P in RSA?

First, factor n. This is not hard; since sqrt(3233) is 56.8…, you only need to test prime numbers up to that. That will give you p and q. Use those to calculate (p-1)•(q-1).


1 Answers

You can use the extended Euclidean algorithm to solve for d in the congruence

de = 1 mod phi(m)

For RSA encryption, e is the encryption key, d is the decryption key, and encryption and decryption are both performed by exponentiation mod m. If you encrypt a message a with key e, and then decrypt it using key d, you calculate (ae)d = ade mod m. But since de = 1 mod phi(m), Euler's totient theorem tells us that ade is congruent to a1 mod m -- in other words, you get back the original a.

There are no known efficient ways to obtain the decryption key d knowing only the encryption key e and the modulus m, without knowing the factorization m = pq, so RSA encryption is believed to be secure.

like image 68
Jim Lewis Avatar answered Oct 31 '22 13:10

Jim Lewis