pySim-prog and pySim-read currently echo back the pcsc reader id (or
baudrate/socket, depending on the interface used). This makes the output
unecessarly undeterministic, which becomes a problem when verifying the
putput in tests. Lets not echo those variable, user supplied parameters
back. Also lets move the code that does the initalization to utils, so
that it can be used from pySim-prog and from pySim-read (code dup).
Change-Id: I243cc332f075d007b1c111292effcc610e874eb3
Related: OS#4503
The method update_ad() caluclates the size of the data it had just
read from EF.AD, but the result is never used, lets remove that
line
Change-Id: Id38c0dc725ab6874de3ea60132482a09372abe9e
The hex string consists of contains zero or more ePDG identifier data objects.
Each ePDG Identifier TLV data object consists of tag value of '80', length, address type, identifier.
TS 31.102 version 13.4.0 Release 13. The same parsing method applies for both EF.ePDGId and EF.ePDGIdEm
Change-Id: I96fb129d178cfd7ec037989526da77899ae8d344
The functions are imported from the git commit 2a81963790e27eb6b188359af169c45afb6d3aaf from master branch
Change-Id: I5c7fdbd122e696d272f7480785d0c17ad2af138c
As per TS 31.103, This EF indicates which ISIM services are available.
If a service is not indicated as available in the ISIM, the ME shall not select this service.
Parsing of IST is achieved by first selecting the ISIM application using its AID.
This is followed by selecting EF.IST with File ID - 6f07 in ADF.ISIM
Change-Id: I3f0a7227360b72a707dc1bcc4cc9c8a4ec7ad2b2
This commit introduces a lookup table which maps ISIM Service Number to its description.
The mapping is defined in 3GPP TS 31.103 version 14.2.0 Release 14, 4.2.7 EF.IST (ISIM Service Table)
Change-Id: Iad51d0804259df47729308b461062f794b135e66
As per TS.31.102, This EF indicates which USIM services are available.
If a service is not indicated as available in the USIM, the ME shall not select this service.
Parsing of UST is achieved by first selecting the USIM application using its AID.
This is followed by selecting EF.UST with File ID - 6f38 in ADF.USIM
Change-Id: I54dbbd40bd3d22cee81f7c32e58cd946f8564257
This method helps in printing Service Tables in EF.SST, EF.UST, EF.IST.
Takes hex string of Service table, parses it and prints available service along with its description.
Change-Id: Ie1e82e07ead2e28314a5794661e6b2ced0acd72a
Initially the Card is read assuming a UICC SIM, but in case its not, an
error 6e00 will be thrown indicating CLA not supported and Card has just Classic SIM application.
Ref: https://web.archive.org/web/20090630004017/http://cheef.ru/docs/HowTo/APDU.info
The above link provides the bytes to use for CLA, P1, P2 in APDU
Change-Id: Ifea328eff3a381d7b82118e22d2bc0ec5f8a87e4
If AID of the desired ADF is in the list of AIDs of the Card/Card subclass object
then ADF is selected or else None is returned
Change-Id: Ie5f29eec14f099add1d0978e3e7d4ed3c9130854
This commit introduces a lookup table which maps USIM Service Number to its description.
The mapping is defined in 3GPP TS 31.102 version 13.4.0 Release 13, 4.2.8 EF.UST (USIM Service Table)
Change-Id: Ia9025a4be6ba29fe79ca4bf6c7a452188ea3d454
As per TS.51.011, This EF indicates which services in the SIM are allocated, and whether, if allocated, the service is activated
.If a service is not indicated as available in the SIM, the ME shall not select this service.
Change-Id: Id28a35727adbaaa9df19b1adc621a0c51ad0e51b
This method helps in parsing Service Tables in EF.SST, EF.UST, EF.EST, EF.IST.
Takes hex string as input and output a list of available/enabled services.
Change-Id: I9b72efdb84ba7be4a40928a008a59c67f6fb71d4
This commit introduces a lookup table which maps SIM Service Number to its description.
The mapping is defined in 3GPP TS 51.011 version 4.15.0 Release 4, 10.3.7 EF.SST (SIM Service Table)
Change-Id: I4a416bd8bff563ae08b1b3c053d2047da91667b4
This is a generic function applicable for reading EF records which doesnt require further processing
such EF.SMSP etc while decoding and also to avoid code duplication.
Change-Id: Ic0b4aa11e962b4bb328447b11533136a29ff72d3
This is a generic function applicable for reading EFs which doesnt require further processing
such as GID1, GID2 etc while decoding and also to avoid code duplication.
Change-Id: If3d8fdddb26f9776c89fd442d1d95b83e0d1476b
This function is used to detect the card type and return Card class/Card subclasses object
if its a know card or else None. Also, an initial step towards refactoring of code.
Change-Id: I71f57c6403dc933bd9d54f90df3d3fe105b4f66f
Introduced a new member variable and a member function to Card class to fetch
and store the AIDs present in UICC. And, this variable (a list) is populated
by reading the EF 2f00 under MF 3f00 (function read_aids()).
Change-Id: I7ca77a73ebb42a8ba1381588d878040675d3019a
When pysim-prog programms the application specific files of ISIM and
USIM it selects the application by its AID first. If depending on the
card profile one of the applications is missing the selection of the
related ADF will fail. Lets check the presence of the AID first and if
it is not present lets skip the programming of the related files.
Change-Id: I0eec6ed244320fcd4dc410b6fab20df9c64ff906
Related: SYS#4817
There is a new card version with a different ATR, lets add the ATR for
this card to support it as well.
Change-Id: I222faea89c1df58c36a19b28449dffb84a956e74
Related: SYS#4817
Unlike Python 2, in Python 3 strings also have attribute '__iter__'.
Because of that, a string could be passed to select_file(), that
actually expects a list as the first parameter.
P.S. Madness, Python 3 is just a new different language...
P.P.S. They should have renamed it not to confuse people.
Change-Id: I92af47abb6adff0271c55e7f278e8c5188f2be75
Fixes: OS#4419
From pyscard user's guide [1]:
== Selecting the card communication protocol ==
By defaults, the connect() method of the CardConnection object
will try to connect using either the T=0 or T=1 protocol.
To force a connection protocol, you can pass the required
protocol to the connect() method.
This means that a PC/SC ifd handler may automatically choose T=1
as the highest protocol if the card indicates both in its ATR [2].
Since pySim only supports T=0, let's select it explicitly.
[1] https://pyscard.sourceforge.io/user-guide.html
[2] https://github.com/acshk/acsccid/issues/16#issuecomment-501101972
Change-Id: Ifed4574aab98a86c3ebbeb191f36a8282103e775
In Python 3, traditional division operator returns a float,
while we need a floor integer in the most cases.
Change-Id: I5565eb64a1ddea7075cbb142eaacaa5d494c87bb