I am using p11tool
on CentOS to read a PIV smart card. The card is being read via the coolkey
package driver (using libcoolkeypk11.so
, per p11-kit list-modules
)
I can get a listing of the certs on there using
p11tool --list-all-certs 'pkcs11:model=;manufacturer=;serial=;token=CoolKey'
The list of certs only includes the URL, Type, Label, and ID. Using the GUI Smart Card Manager from the RedHat Enterprise Security Client (esc
package, which requires coolkey
(not opensc
)), I can drill down to view certificate details, like the cert's serial number and fingerprints.
I tried p11tool --info <certurl>
hoping that would provide the details, but that still only lists the four fields seen with --list-all-certs
.
UPDATE: I also tried openssl x509 -engine pkcs11 -keyform engine -text -in <certurl>
but that failed, with the message
140067620280208:error:02001002:system library:fopen:No such file or directory:bss_file.c:402:fopen('<certurl>','r')
How can I view those details using p11tool and/or other command line tools?
openssl
tool expects a file as parameter after the-in
switch. You should export the certificate from the smart card into a file.opensc
installed, which gives youpkcs15-tool
amongst others. Use it with the--list-certificates
and--list-certificate <id>
options.coolkey
, notopensc
. I'll need to look at whether installingopensc
will create any conflicts or problems.