Rather than writing one test class with associated method for each
OTA algorithm / test, let's do this in a data-driven way, where new
test cases just have to provide test data, while the code iterates over
it.
Change-Id: I8789a21fa5a4793bdabd468adc9fee3b6e633c25
The API of the lchan object has changed. It no longer features the reset
method used by the pySim-shell reset command. Let's fix this by using
the reset method of the card object.
Change-Id: I55511d1edb97e8fa014724598ec173dd47fe25c1
This is important to produce the right command syntax when generating
command line reference in the user manual. However, we shouldn't add
this kludge to the individual programs, but only to the documentation
using the :prog: syntax.
Change-Id: I2ec7ab00c63d5d386f187e54755c71ffc2dce429
The routing indicator is BCD-encoded but has an arbitrary length of
1, 2, 3 or 4 digits.
In order to support the odd lengths of 1 or 3, we must not pad on the
byte level, but on the nibble level. This requires a slight extension of
the Rpad() Adapter.
Change-Id: I6c26dccdd570de7b7a4cd48338068e230340ec7c
Fixes: OS#6054
The K value in case of TUAK can be 16 or 32 bytes long. We used to
permit/parse/display 32 bytes even if only 16 bytes was configured.
Let's enforce the correct length of "K".
Fixes: OS#6053
Change-Id: Ia0f9a2138f16dce72f3118001e95baa1c80f23ce
The method reset_card does not return a return code, while the
coresponding pcsc implementation does return 1 on success.
Change-Id: I658dd6857580652696b4a77e7d6cfe5778f09eff
We've had a "suspend_uicc" command since commit
ec95053249 in 2021, but didn't yet
have the corresponding "resume" pair.
Note that you cannot really execute this in a reasonable way from
within pySim, as it is required to power-cycle the card
between SUSPEND and RESUME, see TS 102 221 Section 11.1.22.3.2
Change-Id: I3322fde74f680e77954e1d3e18a32ef5662759f2
The SUSPEND UICC command is a TS 102 221 (UICC) command, so move
it to the UICC Card Profile.
Also, make sure that any shell command sets specified in the
CardProfile are actually installed during equip().
Change-Id: I574348951f06b749aeff986589186110580328bc
prior to this patch, the suspend_uicc command would always cause a
python exception as a list of integers was returned by decode_duration rather than a single integer (that can be used with %u format string).
Change-Id: I981e9d46607193176b28cb574564e6da546501ba
This avoids error messages about re-registering the same TS 102 222
commands during executing the 'equip' command.
Change-Id: I3567247fe84e928e3ef404c07eff8250ef04dfe9
So for some weird historical reasons, the same python module is
available as pycryptodome (Crypto.* namespace) and pycryptodomex
(Cryptodome.* namespace). See the following information on the project
homepage: https://www.pycryptodome.org/src/installation
To make things extra-weird, Debian choose to package pycryptodomex as
python3-pycryptodome
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886291).
So in order to support both Debian-packaged and differently-installed
packages, let's switch to pycryotodomex on all platforms/installers.
Change-Id: I04daed01f51f9702595ef9f9e0d7fcdf1e4adb62
When using AES CMAC for authentication of OTA messages, we must not pad
the user data before calling the CMAC function. This is unlike the DES
MAC, where padding to the DES block size is mandatory.
This bug was discovered when trying to talk OTA with AES to a
sysmoISIM-SJA5. This patch makes the OTA AES interoperate with the
card. Also, with this patch the cryptographic results of pySim/ota.py
are identical to those of the java code
org.opentelecoms.gsm0348.impl.crypto.CipheringManager
Change-Id: I4b40b5857f95ccb21c35795abe7a1995e368bac3
Unfortunately, TUAK requires a number of additional (and
differently-sized) parameters, so the format of EF.USIM_AUTH_KEY
differs significantly depending on TUAK or non-TUAK case.
Change-Id: I0dcfe05777510fb34973dc2259b137133d8e199d
This implicitly adds support for JSON->binary encoding, not just
decoding (previous code predating construct support).
Change-Id: I0994d9f66a504dd3c60b43ed5cf6645515dcbc6a
According to TS 23.003 Section 28.15 and 28.16 both GLI and GCI
are NAI as defined in IETF RFC 7542, which in turn specifies they
are encoded in UTF-8.
Change-Id: I0a82bd0d0a2badd7bc4a1f8de2c3e3c144ee5b12
This file is rather important for 5G SA operation, so we should have
a proper encoder/decoder in place.
Change-Id: I1b37fdfc2807976880b2cafb61951f08eebeb344
Also accept ProtocolError in addition to SwMatchError in filesystem.py
when probing for applications
Change-Id: I82b50408328f8eaaee5c9e311c4620d20f930642
The cards are 99% software-compatible to the SJA2, so let's just
derive the SJA5 class from the SJA2
Change-Id: I706631baaf447c49904277886bc9a3f6ba3f5532
DF.SAIP (SIMalliance Interoperable Profile) is not part of 31.102,
but something from the eSIM/eUICC universe of TCA (formerly known as
SIMalliance). However, as 3GPP does not specify how/where the card
stores the information required for SUCI calculation, the
TCA/SIMalliance standard is the only standard there is. Some CardOS
start to use this standard even for non-eSIM/eUICC use cases.
Change-Id: Iffb65af335dfdbd7791fca9a0a6ad4b79814a57c
The FID in ADF.USIM is different from the FID in DF.GSM. So while
we can re-use the ts_51_011 EF_NIA class definition, we must pass in
a different fid to the constructor.
Change-Id: Ib414d5b476666e276824266e33b341175a2ee05a
Just like the existing commands for UST/IST: Allow the user to
activate/deactivate individual services. As EF.SST also contains
information about "allocation" of a service, let's have commands for
allocation and activation.
Change-Id: If959d06248cb1a9d2c0a21cdd40d438726cbc5f0
pySim-trace.py is broken if pySim is installed using setup.py:
fixeria@DELL:~$ pySim-trace.py
Traceback (most recent call last):
File "/usr/bin/pySim-trace.py", line 8, in <module>
from pySim.apdu import *
ModuleNotFoundError: No module named 'pySim.apdu'
Change-Id: I371143cb4009db46275ec7a020497b909dcc3b4e
In a previous patch the dependency on cmd2 was changed from cmd2==1.5 to
cmd2>=1.5. After this was merged, this lead to the docker images getting
rebuilt and now having a higher cmd2 version that gets used in the CI
checks. So while the patch was in review, pylint was actually running
with a lower cmd2 version and was taking different code paths.
Fix for:
pySim-shell.py:30:4: E0611: No name 'fg' in module 'cmd2' (no-name-in-module)
pySim-shell.py:30:4: E0611: No name 'bg' in module 'cmd2' (no-name-in-module)
pySim-shell.py:154:8: E1123: Unexpected keyword argument 'use_ipython' in method call (unexpected-keyword-arg)
pySim-shell.py:171:30: E1120: No value for argument 'settable_object' in constructor call (no-value-for-parameter)
pySim-shell.py:173:30: E1120: No value for argument 'settable_object' in constructor call (no-value-for-parameter)
pySim-shell.py:175:30: E1120: No value for argument 'settable_object' in constructor call (no-value-for-parameter)
pySim-shell.py:176:30: E1120: No value for argument 'settable_object' in constructor call (no-value-for-parameter)
Fixes: f8a3d2b3 ("requirements.txt: allow cmd2 versions greater than 1.5")
Fixes: OS#6034
Change-Id: I182d3a2b87e70ed551a70c88d3d531a36bf53f53
Since we now have fixed the compatibility issues with recent cmd2
versions, we may allow also versions greater than 1.5 in the
requirements.txt
Change-Id: I87702c5250a3660c84458939167bffdca9c06059
cmd2.fg and cmd2.bg have been deprecated in cmd2 2.3.0 and removed
in cmd2 2.4.0. Let's work around this by a version check.
Related upstream commits:
(See also: https://github.com/python-cmd2/cmd2)
Commit f57b08672af97f9d973148b6c30d74fe4e712d14
Author: Kevin Van Brunt <kmvanbrunt@gmail.com>
Date: Mon Oct 11 15:20:46 2021 -0400
and
Commit f217861feae45a0a1abb56436e68c5dd859d64c0
Author: Kevin Van Brunt <kmvanbrunt@gmail.com>
Date: Wed Feb 16 13:34:13 2022 -0500
Change-Id: I9fd32c0fd8f6d40e00a318602af97c288605e8e5
In version 2.0.0, the use_ipython parameter in the Cmd constructor is
renamed to include_ipy. There are still plenty of older cmd2
installations around, so let's work around this using a version check.
See also: https://github.com/python-cmd2/cmd2
Commit: 2397280cad072a27a51f5ec1cc64908039d14bd1
Author: Kevin Van Brunt <kmvanbrunt@gmail.com>
Date: 2021-03-26 18:56:33
This commit is based on pySim gerrit changes:
Ifce40410587c85ae932774144b9548b154ee8ad0
I19d28276e73e7024f64ed693c3b5e37c1344c687
Change-Id: Ibc0e18b002a03ed17933be4d0b4f4e86ad99c26e
In cmd2 relase 2.0.0 the constructor of Settable adds a settable_object
parameter, which apparantly was optional at first, but then became
mandatory. Older versions must not have the settable_object parameter
but versions from 2.0.0 on require it. Let's add a version check so that
we stay compatible to cmd2 versions below and above 2.0.0.
See also: https://github.com/python-cmd2/cmd2
Commit 486734e85988d0d0160147b0b44a37759c833e8a
Author: Eric Lin <anselor@gmail.com>
Date: 2020-08-19 20:01:50
and
Commit 8f981f37eddcccc919329245b85fd44d5975a6a7
Author: Eric Lin <anselor@gmail.com>
Date: 2021-03-16 17:25:34
This commit is based on pySim gerrit change:
Ifce40410587c85ae932774144b9548b154ee8ad0
Change-Id: I38efe4702277ee092a5542d7d659df08cb0adeff