PeculiarVentures / graphene-cli

The graphene-cli is a cross-platform command line tool for working with PKCS#11 devices
MIT License
5 stars 11 forks source link

Error C_GenerateKey:894 #10

Open kreciszd opened 4 years ago

kreciszd commented 4 years ago

When I perform: module load -l /opt/safenet/lunaclient/lib/libCryptoki2_64.so -n LunaHSMslot open --slot 0 and: slot open --slot 0

I have one slot with info: Handle: Description: HA Virtual Card Slot Manufacturer ID: Safenet, Inc. Firm version: 7.4 Hardware version: 0.0 Flags: HW: true Removable device: false Token present: true Token: Label: Test Manufacturer ID: Safenet, Inc. Model: LunaVirtual Serial number: 11365537499121 Max PIN length: 255 Min PIN length: 7 Max session count: 0 Session count: 0 Max RW session count: 0 RW session count: 0 Total private memory: 409782 Free private memory: 403510 Total public memory: 409782 Free public memory: 403510 Firm version: 7.4 Hardware version: 0.0 Flags: Initialized: true Logged in: true

In object test I got: Error Unknown error:2147483674 at Error (native) C_GenerateKey:894 Also with test command test sign --slot 0 -it 200 -a all I got: Error Unknown error:2147483674 at Error (native) C_GenerateKeyPair:923

object list gave me:

ID Class Label
1e8482 CERTIFICATE CERT
object info -i 1e8482 Name Value
Handle 1e8482
Class CERTIFICATE
Label CERT
Token true
Private false
Modifiable true

I cannot test anything because of this C_GenerateKeyPair:923 error. What could be the reason of that ?

rmhrisk commented 4 years ago

This is a vendor specific error, we would have to contact Safenet for more information. We do not currently have access to a safenet device for testing also.

I did find this: https://groups.google.com/forum/m/#!msg/pkcs11interop/CT_EhSyx95s/hMQCo2QHAQAJ

Matt561 commented 4 years ago

@kreciszd This seems to happen when you don't have the correct permissions to perform actions on the hsm. Make sure that you pass in your CryptoOfficer's password when you're opening your slot.

Ex. slot open -s 0 -p <CryptoOfficer's password>

This should allow you to generate keys without error.