First I create private key with openssl:
openssl genrsa -des3 -out private.key 1024
So I have now private key with passphrase and now create CSR:
openssl req -new -key private.key -out CSR.csr
However when I display content of this CSR then there is included public key:
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (1024 bit)
Modulus:
Where this public key come from if I provided only private key?
Where this public key come from if I provided only private key?
For RSA, the private key is {n,e,d}
. n
is the modulus, e
is the public exponent, and d
is the private exponent.
There are some additional parameters that can be used to speed up RSA operations, such as dp
and dq
, but they aren't strictly needed. And they should be kept private.
For RSA, the public key is {n,e}
. So the values are always available if you have the private key. n
is the modulus and e
is the public exponent as with the private key.
If you somehow manage to lose e
, you can often recover it because its often a well known value such as 3, 17, or 65537. If you lose d
, you'll have factor n
to recover it.