Change in pysim[master]: SimCardCommands: detect whether UICC or Classic SIM

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu May 6 10:11:34 UTC 2021


dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/24160 )

Change subject: SimCardCommands: detect whether UICC or Classic SIM
......................................................................


Patch Set 2: Code-Review-1

(2 comments)

I think this needs improvement, also I think this may be partially redundant to the generic SIM/USIM support for pySim-shell.py, which I am currently working on.

First of all we consciously decide the APDU parameters for each card and I think it should be kept that way. All those classes have autodetect methods which essentially go by the ATR. I plan to have generic classes SimCard, IsimCard and UsimCard. Those will have autodetect methods that will check weather it is a UICC or not. If it is a UICC it will further check if it is an USIM or ISIM by looking at the app-ids in EF.DIR

I think it makes sense to use detect_card_type() for the first step (distinguishing from UICC), but I think the code is much more readable when the parameter change takes place in the autodetect method.

Once the detection is inside the base classes things will be simpler the code will only call card_detect() and get either a specific card or a generic SimCard, IsimCard or UsimCard back and the APDU parameters will also be adjusted already.

Its not very far yet, but here is the change-id: Id6527254a7305516f2d00876815e46a3c71a81b6

regards.
Philipp

https://gerrit.osmocom.org/c/pysim/+/24160/2/pySim-prog.py 
File pySim-prog.py:

https://gerrit.osmocom.org/c/pysim/+/24160/2/pySim-prog.py@661 
PS2, Line 661: 
This is dangerous. Have a look at the test output from jenkins. You will see that the FairwavesSIM fails. I ran into the same problem recently. This card seems to have a problem when trying to adm-authenticate+program with UICC APDUs.

In cards.py we consciously decide whether to use UICC or the old SIM APDUs. This should be retained - especially for pySim-prog.py


https://gerrit.osmocom.org/c/pysim/+/24160/2/pySim/commands.py 
File pySim/commands.py:

https://gerrit.osmocom.org/c/pysim/+/24160/2/pySim/commands.py@124 
PS2, Line 124: 
I think it would be a good idea to restore the cla_byte and sel_ctrl after the detection is done. The change should be a conscious decision by the API user.



-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/24160
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I224bd6c91cdaf444e2a94117f64030c024a776a7
Gerrit-Change-Number: 24160
Gerrit-PatchSet: 2
Gerrit-Owner: Falkenber9 <robert.falkenberg at tu-dortmund.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Comment-Date: Thu, 06 May 2021 10:11:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210506/3790ddfa/attachment.htm>


More information about the gerrit-log mailing list