Public bug reported:

This is maybe related to #1312462.

After setting up either as Software HSM from opencryptoki or libSoftHSM,
do the following to reproduce the problem:

> openssl ecparam -name brainpoolP256r1 -out test.pem -genkey

> openssl ec -in test.pem -pubout -out test_pub.pem

> pkcs11-tool --module /usr/lib/opencryptoki/ --login --pin 
> 000000 --write-object test_pub.pem --type pubkey
Using slot 0 with a present token (0x3)
error: OpenSSL error during RSA public key parsing

Expected behaviour: the key is imported as elliptic curve key.

Importing the private key works:

> pkcs11-tool --module /usr/lib/opencryptoki/ --login --pin 
> 000000 --write-object test.pem --type privkey
Using slot 0 with a present token (0x3)
Created private key:
Private Key Object; EC
  Usage:      decrypt, sign, unwrap
warning: PKCS11 function C_GetAttributeValue(ALWAYS_AUTHENTICATE) failed: rv = 

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: opensc 0.15.0-1ubuntu1
ProcVersionSignature: Ubuntu 4.4.0-47.68-generic 4.4.24
Uname: Linux 4.4.0-47-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Dec  1 09:31:46 2016
InstallationDate: Installed on 2016-07-07 (146 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
SourcePackage: opensc
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: opensc (Ubuntu)
     Importance: Undecided
         Status: New

** Tags: amd64 apport-bug xenial

You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

  pkcs11-tool fails to import EC public keys

To manage notifications about this bug go to:

ubuntu-bugs mailing list

Reply via email to