[Pcsclite-muscle] macOS and proprietary reader SCardControl interface
Martin Paljak
martin at martinpaljak.net
Tue Jun 13 07:28:02 PDT 2023
Hello,
I'm trying to do NFC tag emulation with ACS ACR1252U reader, via proprietary SCardControl commands. Things work on Linux (Debian Bookworm) and Windows10, but not on macOS (13.4), which should also carry the same open source CCID driver.
I trigger things via Java/jnasmartcardio on a M1 mac. The proprietary ACS commands don't work, except for pinpad properties request, as seen below:
Linux:
# query pinpad properties, success
SCardControl("ACS ACR1252 CL Reader [ACR1252 Reader PICC] 01 00", 0x42000D48, null) -> 110442330011120442330012130442000DAC
SCardControl("ACS ACR1252 CL Reader [ACR1252 Reader PICC] 01 00", 0x42330012, null) -> 010200000301000901030B022F070C023E220A0400000100
SCardDisconnect("ACS ACR1252 CL Reader [ACR1252 Reader PICC] 01 00", false) tx:0/rx:0 in 1ms
# issue ACS proprietary command for firmware version, success
SCardConnect("ACS ACR1252 CL Reader [ACR1252 Reader PICC] 01 00", DIRECT) -> DIRECT
SCardControl("ACS ACR1252 CL Reader [ACR1252 Reader PICC] 01 00", 0x42000DAC, E000001800) -> E10000000F41435231323532555F563230362E30
macOS:
# query pinpad properties, success
SCardConnect("ACS ACR1252 Reader", DIRECT) -> DIRECT
SCardControl("ACS ACR1252 Reader", 0x42000D48, null) -> 120442330012
SCardControl("ACS ACR1252 Reader", 0x42330012, null) -> 010200000301000901000B022F070C023E220A0400000100
SCardDisconnect("ACS ACR1252 Reader", false) tx:0/rx:0
# issue ACS proprietary command for firmware version, failure
SCardConnect("ACS ACR1252 Reader", DIRECT) -> DIRECT
SCardControl("ACS ACR1252 Reader", 0x42000DAC, E000001800)-> SCARD_E_NOT_TRANSACTED
In system log of M1 mac, after enabling smart card logging via:
sudo defaults write /Library/Preferences/com.apple.security.smartcard Logging -bool yes
sudo log stream --debug --info --source --style syslog --predicate '((subsystem == "com.apple.CryptoTokenKit") || (process == "com.apple.ifdreader"))'
I get
Good:
2023-06-13 10:44:58.875358+0300 localhost com.apple.ctkpcscd[67894]: <com.apple.ctkpcscd> [com.apple.CryptoTokenKit:pcsc] received new request 10 for peer 0x1598041a0
2023-06-13 10:44:58.875603+0300 localhost com.apple.ifdbundle[67782]: <com.apple.ifdbundle> [com.apple.CryptoTokenKit:smartcard] -> IFDHControl_v3(00000000, code=1107299656, in={length = 0, bytes = 0x})
2023-06-13 10:44:58.875644+0300 localhost com.apple.ifdbundle[67782]: <com.apple.ifdbundle> [com.apple.CryptoTokenKit:smartcard] <- IFDHControl(out={length = 6, bytes = 0x120442330012}) = 0
2023-06-13 10:44:58.875718+0300 localhost com.apple.ctkpcscd[67894]: <com.apple.ctkpcscd> [com.apple.CryptoTokenKit:pcsc] answering operation 10, result 0
Bad:
2023-06-13 10:47:36.493398+0300 localhost com.apple.ctkpcscd[68152]: <com.apple.ctkpcscd> [com.apple.CryptoTokenKit:pcsc] received new request 10 for peer 0x151e10b70
2023-06-13 10:47:36.493612+0300 localhost com.apple.ifdbundle[67782]: <com.apple.ifdbundle> [com.apple.CryptoTokenKit:smartcard] -> IFDHControl_v3(00000000, code=1107299756, in={length = 5, bytes = 0xe000001800})
2023-06-13 10:47:36.493700+0300 localhost com.apple.ctkpcscd[68152]: <com.apple.ctkpcscd> [com.apple.CryptoTokenKit:pcsc] answering operation 10, result -2146435050
2023-06-13 10:47:36.493646+0300 localhost com.apple.ifdbundle[67782]: <com.apple.ifdbundle> [com.apple.CryptoTokenKit:smartcard] <- IFDHControl(out=(null)) = 606
As the CCID driver should be the same for mac and linux, is there anything I've missed? Would love to try with an intel mac just to be sure, but looking at the low level debug code I *think* there should be no endian issues in the code path.
Any ideas what could be wrong or what could be done ?
Best,
--
Martin Paljak
+372 5156495
More information about the pcsclite-muscle
mailing list