For RSA, how do i calculate the secret exponent?

前端 未结 1 1986
遇见更好的自我
遇见更好的自我 2020-12-09 18:20

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 exponen

相关标签:
1条回答
  • 2020-12-09 18:38

    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.

    0 讨论(0)
提交回复
热议问题