Reputation: 383
Does the public and private key really have equality in encryption?
Is it easier to calculate the public key when you know a private key? Or does it have the same difficulty to calculate another key when you know one of them?
Maybe my expression is not clear. I mean. Is it easier to calculate the public key from the private key than calculate the private key from the public key ?
Upvotes: 2
Views: 541
Reputation: 11828
No. The private key should be kept private as the public key can be generated from the public.
The formula to encrypt with the private key and the formula to encrypt with the public key is not the same.
openssl rsa -in privatekey.pem -pubout
https://security.stackexchange.com/questions/172274/can-i-get-a-public-key-from-an-rsa-private-key
Upvotes: 1
Reputation: 33088
d
and e
are chosen such that they are inverses mod phi(n)
, which is the only relationship they need for the RSA math to work.
In the original RSA paper the formula was to choose a large d
relatively prime to phi(n)
, and calculate e
as a consequence.
Now the algorithm is to choose e
to be a small value relatively prime to phi(n)
and calculate d
. (e
is almost always 0x010001
these days). This lets implementations use a fast calculation for public key operations and a Montgomery ladder to do a Hamming-weight-blinded computation with the private key.
If a modern key generator produced your key, swapping d
and e
would be bad, because everyone would have a good guess at your private exponent once your public exponent was so big.
Upvotes: 1