Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting the private key for a certificate as a PEM-formatted String #107

Open
nathan-brainkey opened this issue Aug 20, 2024 · 0 comments
Open

Comments

@nathan-brainkey
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant