The module sysmo-usimsjs1.py contains a lot of functions that could also
be methods of a class. Lets refactor those functions into class. This is
also an intermediate step towords support for different card models in
the future.
Related: SYS#4466
Change-Id: I2230f50b9d3c85a0d23b29ba5ed0af2471d22e8c
To find out which algorithm ID corresponds to which string and vice
versa we currently use tables and dictionaries. However, this way can be
generalized and other parts of the program can profit from that
Change-Id: I68388ae27d05fcd1bc9de100e040da0c2bb8e799
Related: SYS#4466
ef_mlngc currently has no encoding method at the moment. Instead it
reads and writes the parameters directly using offsets. This is a bit
complicated, lets rather read and write the file in a single go and
encode/decode the contents using class methods (like we already do with
the other files)
Change-Id: Ia5c64710306b763804254cf9807e81627a699728
Related: SYS#4466
The length of the ADM1 key is currently not checked. The key is 8
digits long for all sysmo-usim-sjs1 cards. Lets make sure that the
length is checked before trying to authenticate.
Change-Id: I10a89d8343c889f6c1b2cf3fc67d08dcf08790cf
The file EF.AD contains the length of the MNC, this allows to phone to
distinguish where MCC/MNC end and where the MSIN number of the IMSI
begins. All cards are shipped with an MNC length of 2, which is fine for
the most situations, but when a MNC with 3 digits is needed the MNC
length value has to be updated. Otherwise the phone will recognize the
third digit of the MNC as part of the MSIN.
Related: OS#3850
when programming the 3G authentication (EF_AUTH), the parameter for 2G
is used.
- make sure that parameter algo_3g_str is used to select the 3g
authentication algorithem, do not use algo_2g_str here.
Change-Id: I6aaf49062f6faf36455dc48639dc58f3da8e804d
We unconditionally display the IMSI but we still lack support for
writing it. Lets support writing the IMSI as well in order to be more
complete.
- Add support for writing the IMSI
Change-Id: I1b3d1e1aae953663c13e78217de2a8ec3282b969
Related: OS#3376
The test 04_algo.sh suggests that an algorithm should also be
identified by its number (this is the old way). Since we upgraded
the commandline interface to accept the names of the algorithms the
support for the old way that used numbers had been removed. However,
we should stay compatible with the old method to keep legacy scripts
of customers working.
- Check if the given parameter that references tha algorithem is
a number. If yes, us it, otherwise lookup the number by the
given string name.
Change-Id: Ib41e4870d05820b6967f648eeeba416113bbc120
Related: OS#3376
Collapse two functions of if-cascades into a data structure matching algo
numbers with string names. Use dicts produced from the initial tuple defining
the relation, to re-implement the functions.
When printing out algos, also print out the numbers set on the USIM.
This prepares for printing a list of available algos by commandline switch.
The SQNms offset is a *byte* index into the SQNA file, let's divide
this by 6 before showing it to the user, so he can immediately
make the connection into the SQN array dumped below
There are quite complete python utilities already out there as part
of Benoit Micuhau's 'card' python library. They support plenty of
SIM, UICC and USIM related bits. Let's use them rather than re-
inventing the wheel here.
The main program performs ADM1 authentication before using any
of the sysmo_usim_{read,write}* functions, so passing adm1 as
argument to them is just an unused argument that we can remove
If the user submints a wrong ADM1 key with the commandline, the
authentication will fail. However, by the output of the program
it mey not be clear to the user that the reason for the failure
was a wrong ADM1 key. The user might try the same command with
the same parameters a few time and lock down the card.
This commit fixes that by failing gracefully with a very clear
error message. Furthermore, if a decreased authentication counter
is detected, no further authentication attempts will be made
until the user supplies the option -f (--force).
This commit adds a tool that is intended to be used with sysmo-usim
only if some of the highly propritary parameters, which the regular
pysim can not handle, need to be configured.