Open user8547 opened 7 years ago
You/the program should not use a Case-4 APDU with a T=0 card. In fact the driver should convert the Case-4 APDU into 2 TPDU commands (initial command + Get Response command). I just checked ISO 7816-3:2006 page 36.
My CCID driver does NOT convert a Case-4 APDU into 2 TPDU commands. I am even surprised that it works with a Gemalto PC Twin Reader since this is also a TPDU reader.
I think this is a fault from a "misconfigured" Chinese javacard, which behaves in a Chinese way (Unionpay). I know that a misbehaving cards exist, but eventually it must be responded reliably by well-behaving software. How exactly, should be evaluated ASAP.
On Mon, 10 Apr 2017 at 23:37 Ludovic Rousseau notifications@github.com wrote:
You/the program should not use a Case-A APDU with a T=0 card. In fact the driver should convert the Case-4 APDU into 2 TPDU commands (initial command + Get Response command). I just checked ISO 7816-3:2006 page 36.
My CCID driver does NOT convert a Case-4 APDU into 2 TPDU commands. I am even surprised that it works with a Gemalto PC Twin Reader since this is also a TPDU reader.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/martinpaljak/GlobalPlatformPro/issues/67#issuecomment-293071152, or mute the thread https://github.com/notifications/unsubscribe-auth/AACzthuZvUpMTrXNnlZ0RhKSAHZ1tA2Tks5rupLigaJpZM4M4hft .
--
typos expected due to mobile device
try add this code to your gp code System.setProperty("sun.security.smartcardio.t0GetResponse", "false");
6E00 is happening too to my project with no ISD i solved it with the code this is only happening in java, because i try use PyApduTools initialize update working fine
Here is T=0 only card that produces SW 0x6E00 on INITIALIZE UPDATE when "OMNIKEY CardMan 1021 00 00" reader is used, while works fine when "Gemalto PC Twin Reader 00 00" is used.
OMNIKEY CardMan 1021 00 00:
Gemalto PC Twin Reader 00 00:
The problem can be reproduced also in non-ISD applet. I.e., by sending APDU "80 50 00 00 08 e4 ff 61 7a 53 f8 01 73 00" to applet, responding with SW "61 1c" and then sending "APDU 80 c0 00 00 1c" to applet. The applet logged received APDUs which where later dumped from the card.
In case of OMNIKEY reader the second APDU received by the applet is incorrect (note the prepended 0x00):
while in the case of Gemalto reader the APDUs received are as expected:
If the last Le=0x00 byte is removed from the INITIALIZE UPDATE APDU, the GET RESPONSE APDU is received by card correctly, without 0x00 byte prepended. Hence it seems that in case 4 APDU the Le is buffered (in the card or reader!?) and sent before the next APDU.
This is not purely the card bug since with the other reader APDU is sent correctly. This is also not purely the reader bug, since with other T=0 cards and OMNIKEY reader I could not reproduce the problem.
The question to GlobalPlatformPro maintainers is whether workaround of removing Le/Ne byte can be implemented for APDUs sent over T=0?
The Le byte was introduced as a workaround for Gemalto cards in this commit https://github.com/martinpaljak/GlobalPlatformPro/commit/8981c63ea9570d244198602aef3f81a9480ccea8. I suppose that removing Le for case 4 APDUs over T=0 should not create a problem for Gemalto cards, since Le byte in case 4 APDUs over T=0 is not (should not be) included in TPDU anyway.