-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] T0/T1 protocol choice during SCardConnect and SCardTransmit #213
Comments
|
The pcsclite/ccid driver functions call stack looks like this (only the protocol is left as parameters for convenience): As the CCID reader has feature "Automatic parameters negotiation made by the CCID", in the function if (ccid_desc->dwFeatures & CCID_CLASS_AUTO_PPS_PROP)
goto end; Under the if (ccid_desc->dwFeatures & CCID_CLASS_AUTO_PPS_PROP)
DEBUG_COMM("Skip SetParameters"); At the end of the method we can see: ccid_desc->cardProtocol = Protocol;
As automatic parameters negotiation is proprietary algorithm (this is mentioned in the CCID specification rev. 1.1), I cannot find out how to know which protocol is chosen. Maybe you have thoughts about it.
|
We could use the CCID command Is it problematic if the pcsc-lite does not fail The only case I see that would be problematic is if the reader is in TPDU mode. Only 1 reader has such configuration: the SCM SCL010 https://ccid.apdu.fr/select_readers/?dwFeatures=6&dwProtocols=3&dwFeatures=12 |
Yes, but this command may not be supported by the reader (see possible errors of
The only thing I see is that the pcsclite user will think that the communication between the card and the reader will be carried out via the T0 protocol, but in fact it will not. |
Exact. |
I have not seen any problems with current pcsclite implementation, but I think it would be more honest to abort the communication. What do you think about it? Is such a situation specified in the standards and specifications and is its implementation important? Maybe your expertise says that such a situation is extremely unlikely for modern readers, and support of some abstract situations is not just difficult, but even impossible? |
It would be interesting to know what Windows is doing in such a case. |
Agreed. Unfortunately, I don't have such a reader to check the behavior. |
I have two questions about your SCardConnect and SCardTransmit implementation.
I call SCardConnect with dwPreferredProtocols = SCARD_PROTOCOL_T0. CCID reader and card both support T0 and T1 protocols, reader has feature "Automatic parameters negotiation made by the CCID". Such readers exist and can be found in https://ccid.apdu.fr/select_readers/?dwFeatures=6&dwProtocols=3. In theory, reader and card can agree on T1 protocol during automatic parameters negotiation, but SCardConnect will return T0 protocol as pdwActiveProtocol because of dwPreferredProtocols. Is it correct behaviour? How to know which protocol is negotiated between reader and card during automatic parameters negotiation? Looking at your sources of SCardConnect and IFDHSetProtocolParameters, I don't see any checks whether the auto-negotiated protocol is equal to the active protocol.
SCardTransmit calls CmdXfrBlock at CCID driver level. I can't figure out why at APDU (short and extended) exchange level APDUs are always transmitted using T0 protocol (even though pdwActiveProtocol can be T1 protocol)? I also noticed that readers from previous question (with Automatic parameters negotiation and T0 and T1 support) have only APDU level of exchange (not TPDU or Character). Is it true that at this level of exchange we don't care which protocol is active - the real communication between reader and card will always be done using the negotiated parameters or T0 only?
Thank you very much for help!
The text was updated successfully, but these errors were encountered: