I want to understand how, using standard tools like openssl (or similar), to derive a child RSA key pair from an existing RSA key pair. Additionally I would like the derived key to contain a reference to it's parent such that the relationship could be verified using the same tools used to create it.

From my research so far it seems like the methodology is to sign an arbitrary value with the parent key and use the result as the derived child key. However, the output of openssl dgst -sign master.pem is not an RSA key but ciphertext. If I'm on the right track, how then do I transform the ciphertext into a private key or key pair (I understand the public key can be generated from the private key).

If that is not the correct way, what should I do instead?

This question seems to be hinting at what I want but does not provide enough detail (at least for my understanding).

  • $\begingroup$ I see a way how OpenSSL will allow you to use an RSA private key to generate a fresh keypair (however, the relationship will only be verifiable if you have the original RSA private key); would that meet your needs? If not, I'm pretty sure what you're asking for isn't supported by the OpenSSL CLI. $\endgroup$ – poncho Jun 19 at 2:56
  • $\begingroup$ Or are you trying to generate a new RSA keypair and a certficate for it signed by the original RSA key? That's standard. $\endgroup$ – fgrieu Jun 19 at 7:31
  • $\begingroup$ @poncho That would be fine, could you outline the command for that? $\endgroup$ – emigojvfbfzhbfpu Jun 19 at 15:18
  • $\begingroup$ @fgrieu That would also be fine to use a certificate to show the relation. $\endgroup$ – emigojvfbfzhbfpu Jun 19 at 15:19
  • $\begingroup$ That would be "openssl genrsa -rand [parent private key file]"; that would tell OpenSSL to generate an RSA keypair, seeded by the parent RSA private key. To verify, you'd do it again (and verify that you get the same RSA key). Far from the cleanest way; however it's about the only way given the options that OpenSSL provides. Normally, it wants to generate a completely random RSA key; to get one that has a known relationship with another key, you need to subvert that somehow. $\endgroup$ – poncho Jun 19 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.