Comment 2 for bug 1312462

Revision history for this message
Jonathan Davies (jpds) wrote :

I did some tests with the latest Git code and something interesting is happening:

Generating a key with Ubuntu packages (0.13.0-3ubuntu4.1):

$ pkcs11-tool --module opensc-pkcs11.so -l --keypairgen --key-type EC:prime256v1 --label "My first EC key"
Using slot 1 with a present token (0x1)
Logging in to "SmartCard-HSM (UserPIN)".
Please enter User PIN:
Key pair generated:
Private Key Object; EC
  label: My first EC key
  ID: foobar
  Usage: decrypt, sign, unwrap
Public Key Object; EC EC_POINT 264 bits
 EC_POINT: 0443044104eb915ffd349158919584cf51915e047784a81a18b3b33804dc318eb0f85608c84f242cba6e88462ed95d15666e0f52659a0abe80b8a0261e30c5b1eab24f80fb
warning: PKCS11 function C_GetAttributeValue(EC_PARAMS) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)

  label: My first EC key
  ID: foobar
  Usage: encrypt, verify, wrap

$ pkcs15-tool -D
...
Private EC Key [My first EC key]
...

But no public key.

Now using pkcs15-tool from upstream Git:

$ ./src/tools/pkcs15-tool -D
...
Public EC Key [My first EC key]
        Object Flags : [0x0]
        Usage : [0x0]
        Access Flags : [0x2], extract
        FieldLength : 256
        Key ref : 0 (0x0)
        Native : no
        ID : foobar
        DirectValue : <present>

Trying to generate a key with latest upstream code:

$ ./src/tools/pkcs11-tool --module opensc-pkcs11.so -l --keypairgen --key-type EC:prime256v1 --label "My first EC key"
Using slot 1 with a present token (0x1)
Logging in to "SmartCard-HSM (UserPIN)".
Please enter User PIN:
error: PKCS11 function C_GenerateKeyPair failed: rv = CKR_FUNCTION_NOT_SUPPORTED (0x54)

Aborting.