CKR_GENERAL_ERROR (0x5) on object read #69
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version: current state of development branch
Board: Pico
Pico-hsm with enabled SecureLock and unlocked.
Output on
/usr/local/bin/pkcs11-tool -Owhen I try to read public key with
I get this (log with APDU commands)
How is the key generated?
Edit: seems an outdated version of OpenSC. Try to use version 0.26
@polhenarejos
It was imported following the method described in this comment
Here is key itself, if needed
didn't help.
I am using this script and it works:
Also
pkcs11-tool:@polhenarejos interesting.
Was the SecureLock enabled on init and the and unlocked before read?
No, it wasn't. Can you try the snippet? To isolate the problem. Perhaps it's the securelock.
I updated the script with SecureLock2 and still works. Can you try it? It is the same as the other comment.
BTW, note that the log you posted is doing an ECDSA signature (4 attempts), nothing related with getting the pubkey. So what is failing in the log is the signature command.
If you want the log generated by
pkcs11-tool, prependOPENSC_DEBUG=9:Hi!
I executed this Python code without encountering any exceptions, but the pkcs11-tool still returned the same error.
Here is output for
pkcs11-tool.output.log
btw, what version of pkcs11-tool do you use?
Hi!
I executed this Python code without encountering any exceptions, but the pkcs11-tool still returned the same error.
Here is output for
pkcs11-tool.output.log
what version of pkcs11-tool do you use?
Btw, when I do RAW ECDSA
At the end of your code, I get this
what am I doing wrong?
I use OpenSC v0.26
EC_RAW requires data previously hashed. The used hash is derived from the length of data. Is the data 32 bytes length?
@polhenarejos
I use secret_key variable as data-to-be-signed, as far as I can see it's 256 bits (32 bytes).
Just updated to OpenSC v0.26, with no luck. Btw, does your script interact with Pico from OS (which one do you use?) directly or from docker?
After inspecting the log, I see the problem but not the cause. Your PCSC is disconnecting the session once it recovers all keys and then try log in. But since it has been disconnected, log in fails and raises the error.
Try without PIN:
and with login first
I guess it won't be any difference, but let's try.
About signature, I confirm it fails. I'll check why later.
Can you try latest nightly development build? It should be fixed. You would need to nuke it first.
@polhenarejos
Patched fixed this issue.
nopin.txt
works fine
withpin.txt
same error. (key was initialized with pin 123456, so here is valid pin)
btw, during signing signing, when pin is important, I get the same error.
There's always a default PIN (648219).
Can you try the second command with with
648219instead of123456? Perhaps it is initialized badly.Edit: why the second command fails? I do not see any error or failing, it just exits with error code 1 but nothing strange is there, all the commands terminate correctly.