I'm trying to present a virtual smartcard to a ubuntu virtual machine. But the smartcard isn't recognized by the vm. Although an Almalinux 9 vm does recognize the virtual smartcard.
I'm using libvirt's smartcard module as described here Smartcard Devices. When I boot up a ubuntu 22.04 vm and run the command pkcs11-tool --module /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so -L
I get the error
Slot 0 (0x0): Gemalto Gemplus USB SmartCard Reader 433-Swap [CCID interface...
(token not recognized)
--edit
It seems like the problem lies with the libccid library packaged with ubuntu 22.04 (libccid version 1.5.0-2). I compiled version 1.4.34 and replaced the libccid.so with my compiled version and then everything worked. I don't know if there's a code regression in libccid, or if it was compiled wrong, or if it's just incompatible.
example output of the same command, but with the self compiled version of libccid.
Available slots:
Slot 0 (0x0): Gemalto Gemplus USB SmartCard Reader 433-Swap [CCID Interface...
token label : cert1
token manufacturer : Common Access Card
token model : PKCS#15 emulated
token flags : login required, PIN pad present, rng, token initialized, PIN initialized
hardware version : 0.0
firmware version : 0.0
serial num : 22ef84d3518c711b
pin min/max : 4/8