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

can't export aeskey #31

Open
paulmgtech opened this issue Nov 6, 2020 · 1 comment
Open

can't export aeskey #31

paulmgtech opened this issue Nov 6, 2020 · 1 comment

Comments

@paulmgtech
Copy link

Hi @primetomas ,

I could generate aes key. But can't export/extract it as Key from HSM.
Can you help me to export aes key?

long aeskey = CE.GenerateKey(session, new CKM(CKM.AES_KEY_GEN),
new CKA(CKA.VALUE_LEN, 32),
new CKA(CKA.LABEL, "labelencaes"),
new CKA(CKA.ID, "labelencaes"),
new CKA(CKA.TOKEN, false),
new CKA(CKA.SENSITIVE, false),
new CKA(CKA.ENCRYPT, true),
new CKA(CKA.DECRYPT, true),
new CKA(CKA.DERIVE, true));

Regards
Paul V

@pentiak
Copy link

pentiak commented Sep 21, 2022

If you managed to create the key with CKA.SENSITIVE=false, you should be able to get the key in the plaintext form by calling CE.GetAttributeValue to get the CKA.VALUE attribute.

If that fails you might try setting the key as extractable (CKA.EXTRACTABLE) and create another wrapping key to wrap and then decrypt the wrapped original key.

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

2 participants