This file existed in earlier specs like Release 3.8.0, but was removed
in later revisions. Still, there are cards around implementing that
older spec, so let's add a decoder.
Change-Id: Ic7163b2a01f64ef1223cf15b8d0813d3edf5b61a
We want to use this class in an upcoming patch for DF_MCS support,
and in order to avoid cyclic imports, EF_UServiceTable must be moved.
Change-Id: I9cd6ab795bfd92f845eb943679a3d6302f1003ce
cards can have multiple logical channels; each logical channel
has its own state of what is the current selected file + application.
Let's split the RuntimeState class into the global RuntimeState and the
per-lchan-specific RuntimeLchan class.
This code doesn't actually introduce any code that uses lchans other
than the basic logical channel (0), but just modifies the data model
to accomodate those in the future.
Change-Id: I7aa994b625467d4e46a2edd8123240b930305360
When using __str__ for a CardDF we would get "DF(DF.TELECOM)"
but when using it on CardADF we would get ADF(a0000000871002)"
instead of "ADF(ADF.USIM)". Let's fix that.
Change-Id: I5801a08bcc28cb222734af6d9ee835227f4fee69
As it is possible to select files relative to the currently selected
ADF, we should keep track of that.
Change-Id: I83c93fdcd23b1d3877644ef0bf72d330343fbbc7
We should first see if any of the files in the tree actually
require a service mapping before raising
ValueError('TODO: implement recursive service -> file mapping')
Change-Id: I9c339f0cac020e7eec7f4f840748040e5f77923d
Service 126 relates to DF.5GS/EF.UAC_AIC. As we are deactivating that
file in the script, we should also disable the related EF.UST service.
Change-Id: Id35035aaf23b2163caed3197786288c87be03cfa
In class SimCard, we specify the key reference for ADM1 as 0x04. in the
UsimCard class, which inherits from SimCard nothing is specified, even
though ETSI TS 102 221 specifies 0x0A as key reference. Lets set the
member in UsimCard accordingly to be closer to the spec.
Note: For the moment this is a cosmetic fix, it does not change the
behaviour since all card classes derived from UsimCard set the key
reference properly.
Change-Id: I96af395b1832f4462a6043cca3bb3812fddac612
ETSI TS 102 221, Table 9.3 specifies 0x0A as default key reference for
ADM1. Lets make sure pySim-shell uses this key-reference if the card is
a generic UICC.
Change-Id: I8a96244269dc6619f39a5369502b15b83740ee45
The TLV IEs FILE SIZE and TOTAL FILE SIZE have a minimum length of 2
byte. Even when the length is in the single digit range two bytes must
be used. See also: ETSI TS 102 221, section 11.1.1.4.1 and 11.1.1.4.2
Change-Id: Ief113ce8fe3bcae2c9fb2ff4138df9ccf98d26ff
When updating files and records there are sometimes huge portions that
are just 0xff. Mostly this is at the end of a file or record that is not
completely used. Lets add a notation to tell PySim-shell how to fill
those sections.
Change-Id: Iedd7887bf7d706878f4a3beca8dbea456404610b
When we run the exporter we also get an error summary at the end.
However, if walk() throws an eception this stops the exporter
immediately and we won't get the summpary. Lets catch exceptions from
walk as well so that we are able to end gracefully.
Change-Id: I3edc250ef2a84550c5b821a72e207e4d685790a5
The walk() method that we use to traverse the whole file system tree is
currently only able to execute action callbacks on EFs. Lets add a
mechanism that allows us to have a second callback that is executed when
we hit a DF or ADF.
Change-Id: Iabcd78552a14a2d3f8f31273dda7731e1f640cdb
The apdu command is used to communicate with the card on the lowest
possible level. Lets make it available even before a card profile (rs)
is avalable. This is especially useful when the card has no files on it,
in this situation pySim-shell will not be able to assign a profile to
the card at all. We can then use the apdu command to equip the card with
the most basic files and start over.
Change-Id: I601b8f17bd6af41dcbf7bbb53c75903dd46beee7
he method probe_file returns the decoded FCP after it managed to
successfully probe the file. Lets also return the encoded FCP string, as
it is needed by the caller.
Change-Id: Ia5659e106fb0d6fb8b77506a10eba309e764723e
The as_json parameter has been added as an additional parameter to the
export function. Lets use a dictionary here and put the parameter in it.
This makes it easier to add more options in the future
Change-Id: Ie860eec918e7cdb01651642f4bc2474c9fb1924f
This information is mandatory for linear files as per TS 102 221 V15
section 11.1.1.4.3. This might not have been spotted earlier because
cards of type sysmoISIM-SJA2 accept creation without it as well.
Change-Id: I8aeb869c601ee5d1c8b02da6d72eb3c50e347982
Before this patch:
$ ./pySim-shell.py -p 0
Card reader initialization failed with an exception of type:
<class 'pySim.exceptions.ReaderError'>
after:
$ ./pySim-shell.py -p 0
Card reader initialization failed with exception:
No reader found for number 0
Change-Id: Id08c4990857f7083a8d1cefc90ff85fc20ab6fef
The DataObject is some weird / rarely used different code than the
normal TLV encoder/decoder. It has apparently so far only been used
for decoding, without testing the encoding side, resulting in related
bugs.
Let's fix those that I encountered today, and add a test case.
Change-Id: I31370066f43c22fc3ce9e2b9ee75986a652f6fc4
While the short ID of this file is 05, the actual file-id is 6f03.
Reference to TS 31.103 section 4.2.3.
Change-Id: Idd572ab064ea38e74dffd583c27ea505b23214a2
This should avoid the following pylint error:
************* Module pySim.ts_31_102
pySim/ts_31_102.py:621:100: E0601: Using variable 'sw' before assignment (used-before-assignment)
Change-Id: I0bb9607cdab0e6e3cd17b4d27129a51a607bc0f2
These commands can be used to decode a user-provided hex-string,
instead of decoding the data read from the file. This is useful
for quickly manually decoding some values read from other locations,
such as e.g. copy+pasted from a eSIM profile in ASN.1 value notation.
Change-Id: I81f73bce2c26e3e5dfc7538d223bb2d2483c7fa0
The OPL has 7 bytes "LAI" as the LAI actually contains a LAC
range (so two more bytes for the end of the 16bit range).
Change-Id: I74bcf10b0a8977af0f2844044a812c5780af1706
range(0,7) in python is 0..6, and not 0..7, so we need range(0.8)
to produce the desired range covering all bits of a byte.
This resulted in services 8,16,24,... not being displayed in
the decoded output of EF.UST / EF.IST.
Change-Id: I22bbc481de342685352bf5b13d54931d3f37f9b7
The SFI TLV contanins not the raw SFI, but it contains the SFI
shifted to left by 3 bits (for some strange reason). So let's
un-shift it.
Change-Id: Ibc69b99010d2a25cbb69b6a3d1585d0cb63f1345