Ok, so the general steps to make a Certificate Signing Request are (as I understand it) as follows:

  • Generate a key pair
  • Put my identifying information and the public key (or its hash) into a document
  • Sign that document (CSR) with the generated private key
  • Send the CSR to a CA who will verify that it's me and return a signed certificate with trust chain (possibly)

Since the actual signed certificate is to associate a trust relationship between my public key and my credentials, a certificate cannot be signed without access to the public key or at least a hash of the public key.

Here's the confusion for me: I see that there is a command I can execute in OpenSSL:

openssl req -out CSR.csr -key privateKey.key -new

This supposedly creates a new CSR using only the private key. I cannot see how this can work.

Is the public key or its hash secretly hidden inside the private key file?

  • 1
    The public key is part of the privat key file: openssl rsa -in privateKey.key -pubout Commented Feb 7, 2017 at 18:39
  • Also DSA and EC(DSA) keys; for those the publickey is (fairly) trivially derivable even if not stored. Although in principle a scheme could exist that certifies publickey hashes (e.g. HPKP preload sort of does), the only certs and CSRs supported by OpenSSL (and other SSL/TLS implementations) are X.509(v3) and PKCS10 which only certify actual publickeys not hashes. Commented Feb 8, 2017 at 7:41
  • For more info on how the public key is contained within the private key file, see crypto.stackexchange.com/questions/45151/…
    – mti2935
    Commented Aug 14, 2021 at 22:27

1 Answer 1


A private key isn't just a big number, it is actually a data structure with several numbers in it.

Here's what a public key looks like (RSA):


And private:


As you can see, the private key includes everything that is in the public key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .