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

Export private key #108

Closed
MrWildanMD opened this issue May 30, 2024 · 4 comments
Closed

Export private key #108

MrWildanMD opened this issue May 30, 2024 · 4 comments

Comments

@MrWildanMD
Copy link

it is possible to export the private key to pem object?

@lfonosol
Copy link

This defeats the purpose of using an HSM module.

What would you need the private key in PEM format for?

@lpreimesberger
Copy link

it's 100% possible - but you need to mark the key as exportable on creation in the HSM (or have imported it from elsewhere originally). default is always 'no' like @lfonosol said. there are vendor specific tools to back up and mirror keys on multiple HSM units.

@nickrmc83
Copy link
Contributor

nickrmc83 commented Jul 12, 2024

I created the below PR for the purpose of exporting keys but it has other uses too. Whilst the PR does not explicitly include key export, it provides a hook to inject custom PKCS11 code to wrap and export keys.

#102

Because not all HSMs are equal in capability (supported algorithms and key types) or configuration, you need to add custom code. You also need to think about whether you're attempting to access the key's plaintext or to export to another secure context via wrapping/encrypting the private key.

@MrWildanMD
Copy link
Author

okay i managed to export it onto plaintext and its succeed with my custom code. Thanks for answers

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

4 participants