Red Hat Bugzilla – Bug 1264645
Card error learning certificate RFC7512 PKCS#11 URI from eToken
Last modified: 2015-10-23 13:26:04 EDT
Created attachment 1075257 [details]
Patch to fix card error
Description of problem:
The pkcs11-helper-rfc7512.patch to support corresponding PKCS#11 URIs for certificates yields an "card error" trying to learn a certificate from an eToken with "gpgsm --learn".
The error seems to be in lib/pkcs11h-serialization.c:__parse_pkcs11_uri. The id part of the PKCS#11 URI is parsed into a field that is one character too short. The call to __parse_token_uri_attr thus fails with return value "CKR_ATTRIBUTE_VALUE_INVALID" since it could not parse the whole id parameter.
The attached patch applied after pkcs11-helper-rfc7512.patch allows to successfully learn the certificate.
Version-Release number of selected component (if applicable):
Take an eToken with a PKCS#11 URI identified certificate.
Steps to Reproduce:
1. Insert the token
2. Execute "gpgsm --learn"
$ LC_ALL=C gpgsm --learn
gpgsm: error learning card: Card error
Thanks for the patch. Can you submit it upstream at https://github.com/OpenSC/pkcs11-helper please?
Erm, the error is in the code added with the pkcs11-helper-rfc7512 patch that is in the Fedora package. As far as I saw it, the code to parse PKCS11 URIs is not present upstream?
Ohh, you are absolutely right, sorry.
Thanks for the patch.
I've updated the (outstanding since December 2014) pull request at https://github.com/OpenSC/pkcs11-helper/pull/4 and packages are building for f22/f23/rawhide.
pkcs11-helper-1.11-7.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16466
pkcs11-helper-1.11-7.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16467
pkcs11-helper-1.11-7.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update pkcs11-helper'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-16466
pkcs11-helper-1.11-7.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
pkcs11-helper-1.11-7.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.