Getting the private key for a certificate as a PEM-formatted String
nathan-brainkey opened this issue · 0 comments
nathan-brainkey commented
Is it currently possible to get the private key associated with a certificate as a PEM formatted String? If so, I am happy to work on an example if someone can point me in the right direction. If not, I am also happy to add that functionality.
The full context is that we are using mTLS gRPC with tonic and need the client certificate and key. The certificate is easy to retrieve with the to_pem function. I haven't been able to figure out how to do the same with the PrivateKey. I can dump the whole cert store using the export_pkcs12, translate that to a String, and extract the private key. However, it seems there must be a better way to do this?
Thanks in advance for any direction or advice!