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

Question regarding get_keys() #157

Open
bentterp opened this issue Jun 27, 2023 · 0 comments
Open

Question regarding get_keys() #157

bentterp opened this issue Jun 27, 2023 · 0 comments

Comments

@bentterp
Copy link

I would appreciate a little guidance on the smart/correct way to get an object pointing to a previously generated key. The documentation shows how to generate or import a key and how to perform operations with keys, but not how to point to already existing keys. (I won't use the term "load" here or such as I do want the keys to remain inside the HSM when the crypto operation is done)

For a symmetric key, the label seems sufficient for specifying which key we want to use:
symmetricKey = session.get_key(label='symmetric')
but the generate_keypair() used for asymmetric key types leads to both public and private key having the same label so the best I have come up with so far is:
privateAsymmetricKey = session.get_key(label='asymmetric', object_class=pkcs11.ObjectClass.PRIVATE_KEY)
publicAsymmetricKey = session.get_key(label='asymmetric', object_class=pkcs11.ObjectClass.PUBLIC_KEY)

Apologies in advance if this is already documented somewhere I've failed to look (or read and failed to understand)

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