VMWare Virtual CCID reader optimization problem
Problem description
A smart card works correctly when attached directly to a virtual machine, but fails when using the VMware Virtual USB CCID shared smart card reader.
Root cause analysis
By examining the APDU traffic with rohitab API Monitor, we found that the APDU sent to the card is not identical between the host and the VM.
Closer inspection of the raw APDU using API Monitor reveals the difference:
vmware-vmx.exe — last byte stripped
The last byte is stripped by VMware. VMware allocates a 258-byte buffer for APDU responses (256 bytes max payload + 2 bytes for SW1/SW2) and truncates the last byte of the command. Sending the APDU without its last byte from the host produces the same (incorrect) result as the VM.