aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-04-27Enable parsing of USIM Service table (UST)Supreeth Herle5-0/+166
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
2020-04-27Remove redundant functionsSupreeth Herle2-30/+0
Change-Id: I2dfb5b662b8a4f351e4a629040b405c182e58e8d
2020-04-27Use helper method to print available service in EF.SSTSupreeth Herle7-243/+244
Change-Id: I375475e9f7210dae4e8da7258d6824dc2d54cf4c
2020-04-27utils.py: Add helper method to parse and print Service TableSupreeth Herle1-0/+31
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
2020-04-27pySim-read.py: Add ability to read Cards with correct CLA, P1 and P2 bytesSupreeth Herle1-1/+11
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
2020-04-16cards.py: Added method to select ADF by its full AIDSupreeth Herle2-0/+19
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
2020-04-16Populate AIDs present on the UICCSupreeth Herle3-2/+7
Change-Id: I4d0d8f5f1e8cb252be55a2995b730927cfa7004d
2020-04-16Define mapping between USIM Service Number and its descriptionSupreeth Herle1-0/+138
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
2020-04-16Add ability to parse SIM Service Table (EF.SST)Supreeth Herle8-2/+264
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
2020-04-01utils.py: Add helper method to parse Service TableSupreeth Herle1-0/+22
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
2020-04-01Define mapping between SIM Service Number and its descriptionSupreeth Herle1-0/+63
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
2020-04-01Use the generic method read_binary of card class to read ADSupreeth Herle1-1/+1
Change-Id: Ie7f62913caed95f482445962954857bb69b58078
2020-04-01Move parsing of MSISDN to generic Card classSupreeth Herle2-6/+11
Change-Id: I5b726bc0dc8c8e5eb42f209b1fe0f35a46ac91be
2020-04-01Use the generic method read_binary of card class to read ACCSupreeth Herle1-1/+1
Change-Id: I92a02c74d64b3120055163548fc128ed6e0650a4
2020-04-01Move parsing of HPLMNAcT to generic Card classSupreeth Herle2-2/+9
Change-Id: I46c863c118dcbef89455c34289ed25e5a342f35b
2020-04-01Move parsing of OPLMNwAcT to generic Card classSupreeth Herle2-2/+9
Change-Id: I8050bd103a7085b2631ddc4e567d15e05f9428f2
2020-04-01Move parsing of PLMNwAcT to generic Card classSupreeth Herle2-2/+9
Change-Id: I14d7c2dc51fac6d5cf4a708a77ad23d252ba6094
2020-04-01Use the generic method read_binary of card class to read PLMNselSupreeth Herle1-1/+1
Change-Id: I0a683c479cd41ccc6a93c23434c73793cb5dc186
2020-04-01pySim-read.py: Use the method declared in cards.py to read SPNSupreeth Herle1-5/+4
Change-Id: I71c29e2d9d62c50d352556710e63ba398269a5c7
2020-04-01Use the generic method read_record of card class to read SMSPSupreeth Herle1-1/+1
Change-Id: I911c5339a739fbdd9d41e61b63f2410c8358815b
2020-04-01Use read_binary function of card class to read GID2 and reduce code duplicationSupreeth Herle2-8/+1
Change-Id: I5d80fcc1446a6691b8e2a09bcec558148fa31ab2
2020-04-01cards.py: Add generic function to read EF record in card classSupreeth Herle1-0/+4
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
2020-04-01cards.py: Add generic function to read EF binary to card classSupreeth Herle1-0/+4
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
2020-03-22Move parsing of GID2 to generic Card classSupreeth Herle2-1/+8
Change-Id: I3fe4b08c888a39cda7e7fce7a467f17908bdc3ad
2020-03-22Move parsing of GID1 to generic Card classSupreeth Herle2-1/+8
Change-Id: Ie96408b1eecd6fc2595d619f6f0e3af851dacecb
2020-03-22pySim-read.py: Use the method declared in cards.py to read IMSISupreeth Herle1-2/+2
Change-Id: I2709b040d956a3a2b9210aa78c82a6ccf482f761
2020-03-22pySim-read.py: Use the method declared in cards.py to read ICCIDSupreeth Herle1-2/+2
Change-Id: I0dcda1ea617f3febe246b360b95887c04e5d2629
2020-03-22pySim-read.py: Added a common card detection function for both pySim-prog.py ↵Supreeth Herle9-36/+44
and pySim-read.py 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
2020-03-19cards.py: Added parsing of all the AIDs in the UICCSupreeth Herle1-0/+15
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
2020-03-13pySim-read.py: support for reading GID2 from SIMSupreeth Herle7-0/+16
Change-Id: I0e893c3929aa1be6b55af296484811a7b94db560
2020-03-13pySim-read.py: support for reading GID1 from SIMSupreeth Herle7-0/+16
Change-Id: I15d061daed20f770b9041977a0b1fc4fe44a8f95
2020-03-11sysmoISIM-SJA2: Add suport for USIM-only and ISIM-only cardsPhilipp Maier1-10/+12
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
2020-03-11sysmiISIM-SJA2: add support for new card model / os versionPhilipp Maier1-0/+5
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
2020-02-27cards: Python 3 fix: use the floor division operator //Vadim Yanitskiy1-4/+4
Change-Id: I21de34133dbc5d859a5b744adc74f706ba2f0dd8
2020-02-27commands: Python 3 fix: properly distinguish str and listVadim Yanitskiy1-8/+2
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
2020-02-27transport/pcsc: explicitly specify T0 protocolVadim Yanitskiy1-1/+5
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
2020-02-27transport/pcsc: cosmetic: reuse the existing code of PcscSimLinkVadim Yanitskiy1-5/+2
Change-Id: I5360df644032b95654e99ccaa5118952e8d55faf
2020-02-27utils: fix dec_msisdn(): properly detect international numbersVadim Yanitskiy1-1/+1
We should match the whole value of ToN, not just one LSB bit. Change-Id: Idc51f09b3420d827a75a1161372e4e97c3ddfbc1
2020-02-15Py2 -> Py3: use the floor division operator // where possibleVadim Yanitskiy3-12/+12
In Python 3, traditional division operator returns a float, while we need a floor integer in the most cases. Change-Id: I5565eb64a1ddea7075cbb142eaacaa5d494c87bb
2020-02-15pySim-read.py: do not import json, it is not neededVadim Yanitskiy1-6/+0
Change-Id: I4ae1d71c5695c9cd8ddebea514847b0be6a24c6c
2020-02-15pySim-prog.py: add support for MSISDN programmingSupreeth Herle7-3/+57
This change implements programming of EF.MSISDN as per 3GPP TS 31.102, sections 4.2.26 and 4.4.2.3, excluding the following fields: - Alpha Identifier (currently 'FF'O * 20), - Capability/Configuration1 Record Identifier ('FF'O), - Extension1 Record Identifier ('FF'O). This feature is introduced exclusively for sysmoUSIM-SJS1. Othere SIM card types need to be tested. Change-Id: Ie033a0ffc3697ae562eaa7a241a0f6af6c2b0594
2020-02-15pySim-read.py: fix reading and parsing of EF.MSISDNSupreeth Herle4-5/+48
This change implements parsing of EF.MSISDN (and thus EF.ADN) as per 3GPP TS 31.102, sections 4.2.26 and 4.4.2.3. Example (commercial SIM card from 401/02): EF.MSISDN: ffffffffffffffffffffffffffff07917787028982f7ffffffffffff Decoded (NPI=1 ToN=1): +77782098287 Note that sysmoUSIM-SJS1 in the test setup has malformed EF.MSISDN, so that's why the test output is changed. Change-Id: Ie914ae83d787e3f1a90f9f305bffd45053b8c863
2020-02-15Fix MCC and MCC representation in the output of pySim-readSupreeth Herle5-23/+48
Change-Id: Ie699c0a38d5ae90e4d6109e4574ce860e4044096
2020-02-15cards/sysmoUSIM-SJS1: support programming of EF.HPLMNwAcTSupreeth Herle1-0/+6
Change-Id: Ida93f4a00fe3b1d0f05d6eeda0e7873ce16d4c17
2020-02-15cards/sysmoUSIM-SJS1: support programming of ACC bitsSupreeth Herle1-0/+3
Change-Id: Id0ed9e5654dc0a70a4732bbe5787f1900789d580
2020-02-15cards: fix reading of EF.HPLMNwAcT in Card.update_hplmn_act()Supreeth Herle1-2/+2
Change-Id: I35848059d6082c379246c8d695cb094c20780d15
2020-02-15cards: cosmetic/indentation fix: use tabs, not spacesSupreeth Herle1-1/+1
Change-Id: I5d9cbdb0ecbee783729d0a208d12f8e59ca957ff
2020-02-15pySim-prog.py: add presence/length checks for user-provided SPNSupreeth Herle2-2/+7
Change-Id: I35fab9a85efda2b83f221a460d31c7d41db582b0
2020-02-15pySim-read.py: print meaningful message when SPN is not setSupreeth Herle3-3/+5
Change-Id: I1d98520f33a8564c7d69f50a0811204f138f9dca
2020-02-14pySim-read.py: fix copy-paste: s/HPLMNAcT/PLMNsel/Vadim Yanitskiy1-1/+1
Change-Id: I4a452a2e439cb713621a028cf0046339f50864b6