Commit Graph

154 Commits

Author SHA1 Message Date
Harald Welte c0499c8330 commands.py: rename select_file() to select_path()
In reality, the function is not a simple avstraction around the SELECT
command, but it iterates over a list/path and selects at each element.

Change-Id: I63e01155de4ae47aeed8500708c0eb6580c7b8d1
2021-03-02 14:26:32 +01:00
Harald Welte a670425088 cards.py: SJS1 + SJA2: Implement + Expose verify_adm() method
SJS1 and SJA2 card types don't use the generic verify_adm()
method of the Card base class, so they must override it with their
own methods.  Only this way application code can call card.verify_adm()
irrespective of the card type.

Change-Id: I05f7f3280873f006310266867f04a9ce1b0a63af
2021-03-02 07:48:22 +01:00
Vadim Yanitskiy 6d5e0c9272 Remove Python shebang from files where it's not needed
Change-Id: I1d08544c37f50416acf8dc30139c572c029790d0
2021-03-01 17:33:46 +01:00
Supreeth Herle be3b64167a pySim-read.py: Enable reading of UICC IARI from ISIM
Change-Id: Iba222421f2fcc2b9b12605608bf640f7627904d0
2021-01-05 15:59:38 +01:00
Supreeth Herle a97944b6ca sysmoISIM-SJA2: Enable programming of EF.ACC
Change-Id: If318117a2339399191dfc3fcec856d9247a034fb
2021-01-05 15:59:38 +01:00
Supreeth Herle c60192375e sysmoISIM-SJA2: Enable programming of EF.MSISDN
Change-Id: I8ed27142009a50a1cc31a9f2e0e854a53add6e89
2021-01-05 15:59:37 +01:00
Supreeth Herle be7007e1d9 sysmoISIM-SJA2: Add support for programming IMS public user identity
This EF contains one or more records, with each record able
to hold a public SIP Identity (SIP URI) of the user. EF.IMPU consist of URI TLV data
object values see IETF RFC 3261. The URI shall be encoded to an octet string according
to UTF-8 encoding rules as specified in IETF RFC 3629

./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid epdg.epc.mnc001.mcc001.pub.3gppnetwork.org --pcscf pcscf.ims.testop.org --ims-hdomain ims.testop.org --impi 1234567895@ims.testop.org --impu sip:5987654321@ims.testop.org

Change-Id: If10bc2e50eca390b81755b5cc7211e695233612d
2021-01-05 11:46:41 +01:00
Supreeth Herle a5bd9684d3 sysmoISIM-SJA2: Add support for programming IMS private user identity
This EF contains the private user identity of the user. EF.IMPI consist of
NAI TLV data object values see IETF RFC 2486. The NAI shall be encoded to
an octet string according to UTF-8 encoding rules as specified in IETF RFC 3629

./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid epdg.epc.mnc001.mcc001.pub.3gppnetwork.org --pcscf pcscf.ims.testop.org --ims-hdomain ims.testop.org --impi 1234567895@ims.testop.org

Change-Id: Ic1ccf99b5aa45297ef1e43a43373df603f756379
2021-01-05 11:46:41 +01:00
Supreeth Herle 0c02d8a57b pySim-read.py: Enable reading of EF.IMPU from ISIM
IMS public user identity (IMPU)
As per TS1.103, this EF contains one or more records, with each record able
to hold a public SIP Identity (SIP URI) of the user. EF.IMPI consist of URI TLV data
object values see IETF RFC 3261. The URI shall be encoded to an octet string according
to UTF-8 encoding rules as specified in IETF RFC 3629

Reading of EF.IMPU is achieved by first selecting the ISIM application using its AID.
This is followed by selecting EF.IMPU with File ID - 6f04 in ADF.ISIM

Change-Id: Icf78a564aeaf4254658d3b018ff57dfc4b987e6f
2021-01-05 11:46:41 +01:00
Supreeth Herle 3f67f9c1d3 pySim-read.py: Enable reading of EF.IMPI from ISIM
IMS private user identity (IMPI)
As per TS1.103 version 14.2.0, this EF contains the private user identity of the user.
EF.IMPI consist of NAI TLV Data object.The NAI shall be encoded to an octet string
according to UTF-8 encoding rules as specified in IETF RFC 3629.

Reading of EF.IMPI is achieved by first selecting the ISIM application using its AID.
This is followed by selecting EF.IMPI with File ID - 6f02 in ADF.ISIM

Change-Id: I8d8e76e3f6b9ca7a0be262fee99cd5a397edbefa
2021-01-05 11:46:41 +01:00
herlesupreeth 1279085f7e sysmoISIM-SJA2: Add support for programming IPv4 address for PCSCF
This commit allows programming of IPv4 or FQDN in EF.PCSCF

Example:

./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid 172.24.15.20 --pcscf 99.100.80.102 --ims-hdomain testims.org

Change-Id: I247a5413e9e5fef6b9d7b6cb8442313e72f9156a
2021-01-05 11:46:41 +01:00
Supreeth Herle c491dc019f sysmoISIM-SJA2: Add support for programming IPv4 address for Home ePDG Identifier
This commit allows programming of IPv4 or FQDN in EF.ePDGId

Example:

./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid 172.24.15.20 --pcscf pcscf.testims.org --ims-hdomain testims.org

Change-Id: I10a708d3e0c3ae398c942e3529e364dfe4bb23e7
2021-01-05 11:46:41 +01:00
Supreeth Herle 4779034f9e sysmoISIM-SJA2: Fill unused bytes of Home ePDGId with 'f'
Change-Id: Ia0464f230afcb0f37465d3ed0dfd8f417b53b0c3
2021-01-05 11:46:41 +01:00
Supreeth Herle 79f43dda3d sysmoISIM-SJA2: Add support for programming IMS Home Network Domain Name
As per 3GPP TS 31.103, this EF (DOMAIN) can found under ADF.ISIM at File Id 6f03.

The Home Network Domain Name, i.e. FQDN shall be encoded to an octet string
according to UTF-8 encoding rules as specified in IETF RFC 3629 [27].
The tag value of the Home Network Domain Name TLV data object shall be '80'.

Example:

./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid epdg.epc.mnc001.mcc001.pub.3gppnetwork.org --pcscf pcscf.testims.org --ims-hdomain testims.org

Change-Id: I3c823203aee88734ae423e4ad73da1027a4eaeed
2021-01-05 11:46:41 +01:00
Supreeth Herle 44e046240e sysmoISIM-SJA2: Disable Service 95, 99, 115 in EF.UST in case ISIM is present
As per TS 31.102 version 15.2.0 Release 15, section 4.2.8, EFUST (USIM Service Table),
Service n°95, n°99 and n°115 shall not be declared available if an ISIM application is present on the UICC.

Change-Id: Id9709746de99585ad31c4e9659323484fda87b14
2021-01-05 11:46:41 +01:00
Supreeth Herle 05b2807168 pySim-read.py: Enable reading of Home Network Domain Name from ISIM
As per TS1.103 version 14.2.0, this EF contains the home operator's network domain name.
The Home Network Domain Name, i.e. FQDN shall be encoded to an octet string
according to UTF-8 encoding rules as specified in IETF RFC 3629

Change-Id: Ia3c68c717d105e10d52a8e9d170480da2ad7d65a
2021-01-05 11:46:40 +01:00
Supreeth Herle cf727f2733 sysmoISIM-SJA2: Add support for programming Proxy Call Session Control Function address
Example:

./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid epdg.epc.mnc001.mcc001.pub.3gppnetwork.org --pcscf pcscf.testims.org

Change-Id: Ic654baa93e2ecb91ced596b49dde4c1f208ecda2
2021-01-05 10:44:12 +01:00
Supreeth Herle 5ad9aec98f pySim-read.py: Enabled reading P-CSCF address from ISIM
As per 3GPP TS 31.103 version 14.2.0 Release 14, this EF can found under ADF.ISIM at File Id 6f09.

This EF contains one or more Proxy Call Session Control Function addresses.
The first record in the EF shall be considered to be of the highest priority
If ISIM service n°1 and/or service n°5 is available, this file shall be present.

Change-Id: I7a701212c84d3dc5d4c8ccbcf638c97ceda33654
2021-01-05 10:06:19 +01:00
herlesupreeth b0c7d121d7 sysmoISIM-SJA2: Inherit ISIM Card class as SysmoISIMSJA2 UICC contains an ISIM
Change-Id: I87b318d2df491b9d3c90aad0c38be9bd41e6cf56
2021-01-05 10:06:19 +01:00
herlesupreeth ecbada993d cards: Define ISIM Card class
This commit introduces a ISIM generic Card class which can hold
parameters/functions specific to ISIM application on UICC

Change-Id: I242e679ff2f8831175e76d2fcc5fb285d28bd890
2021-01-05 10:06:19 +01:00
Supreeth Herle 3b342c2f14 Re-purpose helper method to be used for parsing Address TLV Object in general
The Address TLV object is used in EF.P-CSCF Address, EF.ePDGId and EF.ePDGIdEm.
See 3GPP TS 31.102 version 13.4.0 Release 13, section 4.2.8, 4.2.102 and 4.2.104.

Address TLV Object format
Tag (1 Byte) - '80'
Length (1 Byte)
Address Type (1 Byte) - '00' (FQDN), '01' (IPv4), '02' (IPv6)
Address (Address Length Bytes)

Change-Id: Ifd8a240f6b5c7736e58a8151295c30ec5b32ed5f
2021-01-05 10:06:19 +01:00
Supreeth Herle acc222f9f0 sysmoISIM-SJA2: Enable Service 106 and 107 after successfully programming EF.ePDGId and EF.ePDGSelection
Service 106 and 107 must be set available in order to ME to consider as supported in USIM:
1. ePDG configuration Information support
2. ePDG configuration Information configured

Change-Id: Ica067915b9d06ba67f53da7d628f8bacde1ab80e
2021-01-05 10:06:19 +01:00
Supreeth Herle f964df4eb5 sysmoISIM-SJA2: Add support for programming EF.ePDGSelection (ePDG Selection Information)
If the EF.ePDGSelection is present, it is populated with a single entry with PLMN 1 set
to Home PLMN of USIM, ePDG FQDN format set to Operator Identifier FQDN and ePDG Priority value
set to 1.

Change-Id: I92f3f813afa41ae497ebc0dc2ca73da810f82364
2021-01-05 10:06:19 +01:00
Supreeth Herle 99d55552d5 pySim-read.py: Enable parsing of EF.ePDGSelection in USIM
As per TS 31.102, this EF can found under ADF.USIM at File Id 6ff4.
Also, if service n°106 and service n°107 are available, this file shall be present.

Change-Id: I98916e6f5c9791aff63c18a3b16bdfb8ae9b2d36
2020-10-21 08:32:55 +02:00
Daniel Willmann 5d8cd9b378 Whitespace fixes
Change-Id: I595c70ca876d07277551d340c3c5df4d49b1928c
2020-10-19 11:01:49 +02:00
Daniel Willmann 677d41bb41 Remove unnecessary semicolon
Change-Id: I9c5665cd2a45a0d06444349eaaeeb5b83a09ffc1
2020-10-19 10:34:31 +02:00
herlesupreeth 4a3580b4c1 Move reading of USIM service table to generic USIM class
Change-Id: I537547f3bd01a547310358f8a8fceddcb4c79f37
2020-10-03 07:37:06 +00:00
herlesupreeth f8232db327 Move reading of ePDG Id to generic USIM class
Change-Id: I716acb994430db3d4e56fea072f8dc2cebeaba84
2020-10-03 07:36:58 +00:00
herlesupreeth 5d0a30c19c Move programminig of ePDG Id to generic USIM class
Change-Id: I198d2d3303343b24ec92ba73cce21257213f6f89
2020-09-29 09:44:24 +02:00
Supreeth Herle 8e0fccdbf3 sysmoISIM-SJA2: Add support for programming Home ePDG Identifier
Example:

./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 \
	-k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 \
	-o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test \
        --msisdn 0598765432100 --epdgid epdg.epc.mnc001.mcc001.pub.3gppnetwork.org

Note:

1. For Operator Identifier based ePDG FQDN must be in the format

epdg.epc.mnc<MNC>.mcc<MCC>.pub.3gppnetwork.org

2. For Tracking/Location Area Identity based ePDG FQDN must be in format

lac<LAC>.epdg.epc.mnc<MNC>.mcc<MCC>.pub.3gppnetwork.org

and

tac-lb<TAC-low-byte>.tac-hb<TAC-high-byte>.tac.epdg.epc.mnc<MNC>.mcc<MCC>.pub.3gppnetwork.org

and

3. For 5GS Tracking Area Identity based ePDG FQDN using a 3 octet TAC

tac-lb<TAC-low-byte>.tac-mb<TAC-middle-byte>.tac-hb<TAC-high-byte>.5gstac. epdg.epc.mnc<MNC>.mcc<MCC>.pub.3gppnetwork.org

Change-Id: Ia00bfea36c50b6a38a5387d2f8147f25c81b1de4
2020-09-15 15:56:31 +02:00
herlesupreeth 71e38482e1 Remove redundant function read_aid()
Change-Id: I46c4ac0b994db7fb5c3113175009175ec5c154e3
2020-09-15 15:56:31 +02:00
herlesupreeth 1a13c44200 Use the function select_adf_by_aid for selecting an AID
Basically, the idea is to read all the AIDs on the UICC once
rather than reading each time we want to select an ADF.

The function select_adf_by_aid select the ADF by its AID which
is already populated by read_aids() function

Change-Id: I5e0e87e9cf238922d60fda7a7836e65f91f2c233
2020-09-15 15:56:31 +02:00
Supreeth Herle 8016405994 cards.py: Populate AIDs present in SysmoISIMSJA2 UICC
Change-Id: I5f00aa9b03b41818aaa95291fe6c1e525bb0571f
2020-09-15 15:56:31 +02:00
Harald Welte 1e42420e57 fix 'TabError: inconsistent use of tabs and spaces in indentation'
those errors appear with python 3.8.5 otherwise

Change-Id: I5e8a41a8aa9abdd0162c4635ccf9bfe736cca27e
2020-08-31 15:05:14 +02:00
Harald Welte ca6739458e Add support for ADF_USIM/EF_EHPLMN
If the EF.EHPLMN exists, it contains the "Equivalent Home PLMN List".
The odd part of that list is that it is not just a list of additional
PLMN identities, but if the first digits of the IMSI are *not* listed
in EF.EHPLMN, then the MCC/MNC of the IMSI prefix is suddently no
longer considered the home network, but the subscriber is roaming.

See TS 23.122: "If the HPLMN code derived from the IMSI is not present
in the EHPLMN list, then it shall be treated as a Visited PLMN for PLMN
selection purposes."

Change-Id: I22d96ab4a424ec5bc1fb02f5e80165c646a748d3
2020-08-28 08:32:55 +00:00
Sebastian Viviani 0dc8f69217 ts_31_102.py: add EF_ADF_map
the EF files in the USIM ADF are different to the ones int the GSM dir
so added the dictionary to avoid conflicts and hardcoded values

the 'DIR' one was added in ts_51_011.py, not sure if it should be there
as it's not in that standard, but did it for simplicity

Change-Id: I458380bf46b2986662ecdede2551c22cd9be92ba
2020-06-03 06:30:37 +00:00
Philipp Maier d58c632277 cards: remove empty erase() methods.
Some of the cards do not implement the erase method that each card
should have. However, having an empty method in each of those classes
does not make too much sense. Lets rather have an erase method in the
superclass (Card) that prints a warning to inform the user that erasing
the spcified card is not supported.

Change-Id: If5add960ec0cab58a01d8f83e6af8cb86ec70a8d
2020-05-22 14:43:15 +02:00
Philipp Maier 5c2cc66de5 cards: add methods to help erasing of file contents
Resetting the contents of a file before re-writing it with parameters
might be helpful when implementing the currently empty erase() methods
of the various card implementations. Lets add two methods, one for
resetting a binary file and one for resetting a specific record in a
record oriented file

Change-Id: I3c3a4ef3d3f358404af307a68a20b7059f1a9e8d
2020-05-22 14:43:15 +02:00
Philipp Maier 7f9f64ac2a cards: reset uninitalized EF.AD
The contents of EF.AD me be uninitalized (all bytes set to 0xff). If
this is the case reset all bytes of the file to 0x00 and continue the
update of EF.AD with this value.

Change-Id: I57cf53e0c540469f11b6d85bd3daf3f9e14c237e
2020-05-17 07:34:14 +00:00
Philipp Maier b689754b49 cards: remove len calculation
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
2020-05-12 11:38:02 +02:00
Harald Welte 32f0d415af Fix writing of EF.HPLMNwAcT on sysmoISIM-SJA2
Change-Id: I9372a1a1f10fbe916659a8a50fe0e164987b2d5d
Closes: OS#4532
2020-05-09 17:26:12 +02:00
Supreeth Herle 69e5d27e3c Remove redundant functions
Change-Id: I2dfb5b662b8a4f351e4a629040b405c182e58e8d
2020-04-27 12:29:00 +02:00
Supreeth Herle f9f3e5e0c1 cards.py: Added method to select ADF by its full AID
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-16 07:55:15 +02:00
Supreeth Herle e26331ef72 Add ability to parse SIM Service Table (EF.SST)
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-16 07:38:27 +02:00
Supreeth Herle 6d66af653f Move parsing of MSISDN to generic Card class
Change-Id: I5b726bc0dc8c8e5eb42f209b1fe0f35a46ac91be
2020-04-01 11:05:26 +02:00
Supreeth Herle a850a47981 Move parsing of HPLMNAcT to generic Card class
Change-Id: I46c863c118dcbef89455c34289ed25e5a342f35b
2020-04-01 09:35:52 +02:00
Supreeth Herle 1757b263bf Move parsing of OPLMNwAcT to generic Card class
Change-Id: I8050bd103a7085b2631ddc4e567d15e05f9428f2
2020-04-01 09:35:52 +02:00
Supreeth Herle 140844052a Move parsing of PLMNwAcT to generic Card class
Change-Id: I14d7c2dc51fac6d5cf4a708a77ad23d252ba6094
2020-04-01 09:35:52 +02:00
Supreeth Herle e573ccb53c Use read_binary function of card class to read GID2 and reduce code duplication
Change-Id: I5d80fcc1446a6691b8e2a09bcec558148fa31ab2
2020-04-01 09:21:20 +02:00
Supreeth Herle ad10d66baf cards.py: Add generic function to read EF record in card class
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-01 09:14:54 +02:00
Supreeth Herle d21349a610 cards.py: Add generic function to read EF binary to card class
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-04-01 09:14:04 +02:00
Supreeth Herle c7f2f7413b Move parsing of GID2 to generic Card class
Change-Id: I3fe4b08c888a39cda7e7fce7a467f17908bdc3ad
2020-03-22 10:17:05 +01:00
Supreeth Herle 98a6927b27 Move parsing of GID1 to generic Card class
Change-Id: Ie96408b1eecd6fc2595d619f6f0e3af851dacecb
2020-03-22 10:17:05 +01:00
Supreeth Herle 4c306ab200 pySim-read.py: Added a common card detection function for both pySim-prog.py 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-22 10:17:03 +01:00
Supreeth Herle e4e98316a8 cards.py: Added parsing of all the AIDs in the UICC
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-19 10:27:48 +01:00
Philipp Maier d950786525 sysmoISIM-SJA2: Add suport for USIM-only and ISIM-only cards
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-11 12:35:20 +01:00
Philipp Maier b3e11ea196 sysmiISIM-SJA2: add support for new card model / os version
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-03-11 12:34:59 +01:00
Vadim Yanitskiy 9664b2e7fc cards: Python 3 fix: use the floor division operator //
Change-Id: I21de34133dbc5d859a5b744adc74f706ba2f0dd8
2020-02-27 02:20:47 +07:00
Vadim Yanitskiy 99affe1529 Py2 -> Py3: use the floor division operator // where possible
In Python 3, traditional division operator returns a float,
while we need a floor integer in the most cases.

Change-Id: I5565eb64a1ddea7075cbb142eaacaa5d494c87bb
2020-02-15 19:11:50 +00:00
Supreeth Herle 5a541016fb pySim-prog.py: add support for MSISDN programming
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-15 04:57:20 +07:00
Supreeth Herle f442fb4d69 cards/sysmoUSIM-SJS1: support programming of EF.HPLMNwAcT
Change-Id: Ida93f4a00fe3b1d0f05d6eeda0e7873ce16d4c17
2020-02-15 03:26:49 +07:00
Supreeth Herle c8796a3184 cards/sysmoUSIM-SJS1: support programming of ACC bits
Change-Id: Id0ed9e5654dc0a70a4732bbe5787f1900789d580
2020-02-15 03:26:49 +07:00
Supreeth Herle 2d7859759e cards: fix reading of EF.HPLMNwAcT in Card.update_hplmn_act()
Change-Id: I35848059d6082c379246c8d695cb094c20780d15
2020-02-15 03:26:49 +07:00
Supreeth Herle 9ca41c1f26 cards: cosmetic/indentation fix: use tabs, not spaces
Change-Id: I5d9cbdb0ecbee783729d0a208d12f8e59ca957ff
2020-02-15 03:26:49 +07:00
Supreeth Herle 840a9e2a76 pySim-prog.py: add presence/length checks for user-provided SPN
Change-Id: I35fab9a85efda2b83f221a460d31c7d41db582b0
2020-02-15 03:26:49 +07:00
Supreeth Herle 7947d92bc1 Added feature to program SPN into sysmoUSIM-SJS1 SIM cards
Change-Id: Ia0f1a36ecb3898eaa1cf9925864e13369b1f31ce
2020-01-21 11:31:56 +01:00
Philipp Maier 0ad5bcfbc1 cards: Add support for sysmo-isim-sja2
The sysmo-isim-sja2 cards are not yet supported by pysim. Lets add
support for writing KI and OPC in ADF.USIM and ADF.ISIM as well as the
remaining common simcard parameters.

Related: SYS#4466
Change-Id: I23e2b46eac0e0dbc2b271983d448999f6a459ecf
2019-12-31 18:02:42 +01:00
Philipp Maier 5a8763154e cards.py: do not use spaces in card names
pySim-prog.py features a way to detect which card type is in the reader.
The returned value is often used as filename for testfiles and other
automated operations. Therefore lets not have spaces in simcard names

Change-Id: Ib7428fab767874dd53478d7c64601ff8938e05aa
2019-11-11 11:03:19 +01:00
Denis 'GNUtoo' Carikli 84d2cb3cb3
python3 conversion: fix tabs and spaces inconsistency
Without that fix we have:
  $ python3 pySim-read.py
    File "pySim-read.py", line 135
      try:
         ^
  TabError: inconsistent use of tabs and spaces in indentation

The following command was used to do the conversion:
  sed 's#        #\t#g' -i $(find -name "*.py")

Then the remaining spaces spotted during the review were
addressed manually.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Change-Id: I83f76a8e9b6e36098f16552a0135a8c22dde545f
2019-09-15 15:53:02 +02:00
Daniel Willmann 7d38d74716 pySim-prog: Print out hex-escaped pin_adm in card parameters
Use h2b to convert pin_adm back to binary form for sysmoSIMgr2

Change-Id: Ia178c9938f3e6a4fbac24d767437894297d1e708
2019-09-03 18:41:05 +02:00
Harald Welte 23888dab85 make writing SMSP optional
Change-Id: Ic5fdd397244cfe73b5b6a12883316072cc10f7b4
2019-08-28 23:20:02 +02:00
Daniel Willmann 67acdbc817 Make programming OPC optional
Change-Id: Ic600c325557918cb7d5b1fb179c01936a078c96c
2019-08-28 23:19:57 +02:00
Philipp Maier 6e507a7786 wavemobile-sim: write mnc-length field ine EF.AD
The length field in wavemobile sim cards is not set, so that the field
stays at its initial value, which is 0xFF. Lets write the correct mnc
length here.

Change-Id: Ieda0ce864bf3e8c7b92f062eaa3a5482c98507e2
Related: OS#3850
2019-04-01 16:33:48 +02:00
Philipp Maier 45daa925bd cosmetic: fix sourecode formatting
Change-Id: I4836826811ffb0aeb103d32eb874f5fa52af4186
2019-04-01 15:50:50 +02:00
Philipp Maier ee908ae195 sysmo-usim-sjs1: update EF.AD with correct MNC length
At the moment EF.AD, which contains the length of the MNC is not
updated. For two digit MNC (the usual case) this is fine since the
length is set to 2 by default. However, when one wants to set an MNC
with 3 digit length the file must be updated, otherwise the third digit
of the MNC is recognized as part of the MSIN.

Change-Id: I827092b2c7f7952f54b2d9f8dbda419a0dbfaf65
Related: OS#3850
2019-04-01 15:50:50 +02:00
Philipp Maier 2d15ea015e cards: sysmo-usim-sjs1: add programming of EF.PLMNsel, EF.PLMNwAcT and EF.OPLMNwAcT
The files EF.PLMNsel, EF.PLMNwAcT and EF.OPLMNwAcT are currently not
programmed for sysmo-usim-sjs1, lets add them.

Change-Id: I0cac3041f1902383d98d6dc211cf31ae6e3a610b
Related: OS#3850
2019-03-21 18:04:26 +01:00
Philipp Maier c8ce82a11f cards: Add support for Wavemobile SIM
Add support to handle Wavemobile sim cards. The support excludes some
parameters. For example it is not possible to write own KI keys yet.

Support covers the following files:
EF.SMSP
EF.IMSI
EF.ACC
EF.PLMNsel
EF.PLMNwAcT
EF.OPLMNwAcT

Not yet supported are:
EF.ICCID
KI (propretary file)
OPc (propritary file)

Change-Id: Ida3f37bd6e3ac995812aeddc9770f1ccd54ecf3f
Related: SYS#4245
2018-09-13 07:18:33 +00:00
Philipp Maier a3de5a331e cards: do not feed ascii as adm for sysmosim-gr1
When sysmosom-gr1 is used with a custom ADM key, then the ADM string is
not fed through h2b() like we see it with sysmo-usim-sjs1 for example.

- feed the ADM to h2b() before use

Change-Id: I0b7cab380b89612ed3b8318e014161038335fe1b
Related: OS#3405
2018-08-23 10:44:33 +02:00
Philipp Maier 087feff7cb cards: autodetect sysmosim-gr1
The sysmosim-gr1 lacks the auto detection feature because no autodetect
is yet programmed inside the related class.

- add autodetect for sysmosim-gr1

Change-Id: Iec1f1ab6824ff2328baedd731b08df997df4da01
Related: OS#3405
2018-08-23 10:43:57 +02:00
Philipp Maier af9ae8bd6e cards: return SW in method update_plmnsel() of class Card
The method update_plmnsel() does not return the status word yet, which
causes pysim-prog.py to print an error message that does not influence
the functionality but does not look nice.

- preserve the status word that is returned with update_binary() and
  return it properly like the other methods do.

Change-Id: I54e8e165f87365e8162b36d24efc8f0db62b66da
Related: SYS#4245
2018-07-13 11:38:04 +02:00
Philipp Maier 1be35bfa09 cosmetic: fix cut and paste error in comment
Change-Id: I506585f8b300bb7a3e20edad7eca134374581d76
2018-07-13 11:36:26 +02:00
Philipp Maier 5bf42600d4 cards: add update method for EF:PLMNsel to Card class
The Card class offers update methods for various EF, but for
PLMNsel there is no update method available yet. Lets add one.

Change-Id: I832f7bef70c92dc101b94ad871b6cafaa626e134
Related: SYS#4245
2018-07-11 23:25:58 +02:00
Todd Neal 9eeadfc46b add support for open cells SIM cards
Change-Id: I4df5681952eefd7a67f5e2b0a96a9e01c9d960d2
2018-04-26 11:11:45 -05:00
Alexander Chemeris e0d9d88cd5 cards: Add Fairwaves SIM implementation.
Change-Id: Ia10ac433d3b0482bdf727c31f65a10042152797b
2018-01-10 17:16:31 +09:00
Alexander Chemeris 8ad124a0b8 cards: Implement card type autodetection based on ATR.
Change-Id: I1099a96626c0ce74243b47a8fdfa25b0d76a1ef3
2018-01-10 17:12:10 +09:00
Alexander Chemeris eb6807d3cb cards: Extend Card class with access functions for some of the standard EF files.
Change-Id: Icb7227fa7ebc837fccab456cbfad529f6ee81a28
2018-01-10 17:12:10 +09:00
Daniel Willmann 1d087efc97 Support writing SMSP for sysmoUSIM-SJS1
Closes: OS#1989
Change-Id: I6cbf69be3d410c18a509b98a63cb69bab74a528a
2017-09-01 07:56:13 +00:00
Philipp Maier e960488338 fix writing of ICCID for sysmo-usim-sjs1
The programming procedure for sysmo-usim-sjs1 lacks
writing the ICCID. This commit adds the missing call
to update_binary()

Change-Id: Ief85aa07c562d8d7b2a6dec302d2f485d0b1e577
2017-04-06 00:38:22 +02:00
Philipp Maier 4146086d2f Fix select control parameter
sysmo-usim-sjs1 requires P2 to be set to 0x0C (request FCI) when
using the USIM application commands. The FCI is not used by pysim
anyway and might even cause problems with other cards.

This commit adds a pair of get/set methods to the SimCardCommands
class in order to set a default for the selection control
parameters (P1, P2). (Similar to the set/get methods for the class
byte)

The SysmoUSIMSJS1 class now calls the setter method for the
selection control parameters inside of its constructuor and sets
the selection control parameter default to "000C". This way we
can be sure that we only change the behaviour for sysmo-usim-sjs1
and do not break support for any other cards.

Change-Id: I1993a267c952bf37d5de1cb4e1107f445614c17b
2017-04-06 00:38:22 +02:00
Jan Balke 3e84067a2b Add provision support for sysmoUSIM-SJS1 cards
The PIN-ADM has to given on the command line as it is provisioned
different for each card.
Currently only Ki, Op and IMSI are provisioned.
2015-08-20 13:32:56 +02:00
Jan Balke c3ebd33544 Add PIN-ADM argument to the command line
Allow overwriting the default PIN-ADM set in the card implementation.
2015-08-20 13:32:56 +02:00
Sylvain Munaut 2fc205ceb9 cards: sysmocom SysmoSIM-GR2 support added to cards
Written-by: Kevin Redon
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-12-23 17:22:56 +01:00
Alexander Chemeris 7be92ff5d2 Move encoder functions for ICCID, IMSI and PLMN to pySim.utils for consistency. 2013-07-13 08:53:21 +02:00
Alexander Chemeris 21885249cf Implement setting of EF.ACC file in GrcardSim and _MagicSimBase
From: Alexander Chemeris <Alexander.Chemeris@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-02 15:19:09 +02:00
Sylvain Munaut 5da8d4e0d4 cards: Fix spacing according to PEP
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-02 15:13:24 +02:00
Sylvain Munaut 053c89578c cards: Fix comment position
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-02 15:12:32 +02:00
Harald Welte 93b38cd0f5 usim/opc: Add support to write completely random OPC
Allow to set the OPC, write it out to the state, generate it randomly.
2012-03-22 15:25:19 +01:00
Holger Hans Peter Freyther 4d91bf449f sysmoUSIM-GR1: Add basic (hacky) support for the sysmoUSIM-GR1
Right now we are only to program the KI, OPC, ICCID and IMSI. This
is done in a direct way and through the card abstraction.
2012-03-22 14:28:38 +01:00
Sylvain Munaut 8ca49e9ca8 cards: SMSP is left padded not right padded
I confused left & right, silly me ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-12-10 09:57:50 +01:00
Sylvain Munaut 607ce2a029 Fix computation of SMSP from a SMSC number
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-12-08 20:16:43 +01:00