RFR [7195480]: javax.smartcardio does not detect cards on Mac OS X

Ivan Gerasimov ivan.gerasimov at oracle.com
Fri May 16 15:54:54 UTC 2014


It was reported that CardTerminal.isCardPresent(), 
CardTerminal.waitForCardAbsent(...) and 
CardTerminal.waitForCardPresent(...) do not work correctly on Mac OS X.
It is due to the difference in the types of the fields of 
SCARD_READERSTATE structure used across different platforms.

In addition to the field type correction, it is also needed to make sure 
the fields are aligned correctly.
I made sure that the total size of the structure (61 bytes) is correct 
by requesting information about the same reader twice:
(had to mess with sun.security.smartcardio.PCSC.SCardGetStatusChange() a 
bit to check, but didn't include it the test).

No new tests go with the fix.
The already existing manual test 
jdk/test/sun/security/smartcardio/TestPresent.java can be used to 
demonstrate the bug with the current jdk.
With the fix this test isn't failing.

I assume that the correct behavior in the case of several card readers 
can be checked with 
jdk/test/sun/security/smartcardio/TestMultiplePresent.java, but cannot 
check it myself as I don't currently have access to a mac comp with more 
than one readers.

Would you please help review the fix?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-7195480
WEBREV: http://cr.openjdk.java.net/~igerasim/7195480/0/webrev/

Sincerely yours,

More information about the security-dev mailing list