Skip to content
Success

Changes

Summary

  1. pySim-shell: use log level INFO by default (details)
  2. card_key_provider: separate and refactor CSV column encryption (details)
  3. card_key_provider: use case-insensitive field names (details)
  4. card_key_provider: rename parameter filename to csv_filename (details)
  5. card_key_provider: remove unnecessary class property definitions (details)
  6. pySim-shell: add command to manually query the Card Key Provider (details)
  7. pySim-shell: re-organize Card Key Provider related options (details)
  8. card_key_provider: remove method _verify_get_data from base class (details)
  9. card_key_provider: refactor code and optimize out get_field method (details)
  10. card_key_provider: add missing type annotation (details)
  11. docs/conf.py: update copyright year (details)
Commit 08565e8a98f616b57d63dfd4043f47a87a1064dd by pmaier@sysmocom.de
pySim-shell: use log level INFO by default

The default log level of the PySimLogger is DEBUG by default. This is
to ensure that all messages are printed in an unconfigured setup.

However in pySim-Shell we care about configuring the logger, so let's
set the debug log level to INFO in startup. This will allow us to
turn debug messages on and off using the verbose switch.

Change-Id: I89315f830ce1cc2d573887de4f4cf4e19d17543b
Related: SYS#7725
The file was modifiedpySim-shell.py
Commit 4550574e032a675cf1030cbe2eb7c9fd7a293147 by pmaier@sysmocom.de
card_key_provider: separate and refactor CSV column encryption

The CardKeyProviderCsv class implements a column decryption scheme
where columns are protected using a transport key. The CSV files
are enrcypted using contrib/csv-encrypt-columns.py.

The current implementation has two main problems:

- The decryption code in CardKeyProviderCsv is not specific to CSV files.
  It could be re-used in other formats, for example to decrypt columns
  (fields) red from a database. So let's split the decryption code in a
  separate class.

- The encryption code in csv-encrypt-columns.py accesses methods and
  properties in CardKeyProviderCsv. Also having the coresponding
  encryption code somewhere out of tree may be confusing. Let's improve
  the design and put encryption and decryption functions in a single
  class. Let's also make sure the encryption/decryption is covered by
  unittests.

Related: SYS#7725
Change-Id: I180457d4938f526d227c81020e4e03c6b3a57dab
The file was modifiedpySim/card_key_provider.py
The file was modifiedtests/unittests/test_card_key_provider.py
The file was modifiedcontrib/csv-encrypt-columns.py
Commit e80f96cc3bc44450ba47d9e71e3dd8086b969066 by pmaier@sysmocom.de
card_key_provider: use case-insensitive field names

It is common in CSV files that the columns have uppercase names, so we
have adopted this scheme when we started using the card_key_provider.

This also means that the API of the card_key_provider_get() and
card_key_provider_get_field() function now implicitly requires
uppercase field names like 'ICCID', 'ADM1', etc.

Unfortunately this may be unreliable, so let's convert the field
names to uppercase as soon as we receive them. This makes the API
case-insensitive and gives us the assurance that all field names
we ever work with are in uppercase.

Related: SYS#7725
Change-Id: I9d80752587e2ccff0963c10abd5a2f42f5868d79
The file was modifiedtests/unittests/test_card_key_provider.py
The file was modifiedpySim/card_key_provider.py
Commit bcca2bffc26558ee42071cb28183af6c7efaa8c3 by pmaier@sysmocom.de
card_key_provider: rename parameter filename to csv_filename

let's rename the parameter filename to csv_filename to make it
more clear to what kind of file this parameter refers.

Change-Id: Id5b7c61b5e72fb205e30d2787855b2c276840a7b
The file was modifiedpySim/card_key_provider.py
Commit a6ca5b7cd107a00f5bfb993fae728c15ebb3a2ce by pmaier@sysmocom.de
card_key_provider: remove unnecessary class property definitions

The two properties csv_file and csv_filename are defined by the
constructor anyway, let's remove the declaration in the class body
because it is not needed.

Change-Id: Ibbe8e17b03a4ba0041c0e9990a5e9614388d9c03
The file was modifiedpySim/card_key_provider.py
Commit 01a6724153bea16813a463670797e1bd796c1dae by pmaier@sysmocom.de
pySim-shell: add command to manually query the Card Key Provider

The Card Key Provider is a built in mechanism of pySim-shell which
allows the user to read key material from a CSV file in order to
avoid having to lookup and enter the key material himself. The
lookup normally done by the pySim-shell commands automatically.

However, in some cases it may also be useful to be able to query the
CSV file manually in order to get certain fields displayed. Such a
command is in particular helpful to check and diagnose the CSV data
source.

Related: SYS#7725
Change-Id: I76e0f883572a029bdca65a5a6b3eef306db1c221
The file was modifiedpySim-shell.py
Commit 4a7651eb65b24f862169161c47fbad81bfd154e9 by pmaier@sysmocom.de
pySim-shell: re-organize Card Key Provider related options

As we plan to support other formats as data source for the Card Key
Provider soon, the more commandline options may be added and it makes
sense to group the Card Key Provider options in a dedicated group.

Let's also rename the option "--csv-column-key" to just "--column-key".
The column encryption is a generic concept and not CSV format specific.
(let's silently keep the "--csv-column-key" argument so maintain backward
compatibility)

Related: SYS#7725
Change-Id: I5093f8383551f8c9b84342ca6674c1ebdbbfc19c
The file was modifiedpySim-shell.py
Commit 579214c4d01ab07f3cec689f72063082a3d67ff0 by pmaier@sysmocom.de
card_key_provider: remove method _verify_get_data from base class

The method _verify_get_data was intended to be used to verify the
user input before it further processed but ended up to be a simple
check that only checks the name of the key column very basically.

Unfortunately it is difficult to generalize the check code as the
concrete implementation of those checks is highly format dependent.
With the advent of eUICCs, we now have two data formats with
different lookup keys, so a static list with valid lookup keys is
also no longer up to the task.

After all it makes not much sense to keep this method, so let's
remove it.

(From the technical perspective, the key column is not limitied to
any specif field. In theory it would even be possible to use the KI
as lookup key as well, even though it would not make sense in
practice)

Related: SYS#7725
Change-Id: Ibf5745fb8a4f927397adff33900731524715d6a9
The file was modifiedpySim/card_key_provider.py
Commit 61541e7502bdabb265e29a03e0f6f84f52aeb5d3 by pmaier@sysmocom.de
card_key_provider: refactor code and optimize out get_field method

The method get_field in the base class can be optimized out. This
also allows us to remove code dup in the card_key_provider_get_field
function.

Let's also fix the return code behavior. A get method in a
CardKeyProvider implementation should always return None in case
nothing is found. Also it should not crash in that case. This will
allow the card_key_provider_get function to move on to the next
CardKeyProvider. In case no CardKeyProvider yields any results, an
exception is appropriate since it is pointless to continue execution
with "None" as key material.

To make the debugging of problems easier, let's also print some debug
messages that inform the user what key/value pair and which
CardKeyProvider was queried. This will make it easier to investigate
in case an expected result was not found.

Related: SYS#7725
Change-Id: I4d6367b8eb057e7b2c06c8625094d8a1e4c8eef9
The file was modifiedpySim/card_key_provider.py
Commit c2fb84251b9b1440e48eee083782bfd9c28b7aac by pmaier@sysmocom.de
card_key_provider: add missing type annotation

Related: SYS#7725
Change-Id: I45751d2b31976c04c03006d8baa195eef2576b4f
The file was modifiedpySim/card_key_provider.py
Commit 3f3f4e20e2fc1b196ce294d46a1df668a0663933 by pmaier@sysmocom.de
docs/conf.py: update copyright year

The copyright year of the docs is still at 2023, let's update it
to the current year.

Change-Id: Icf64670847d090a250f732d94d18e780e483239b
The file was modifieddocs/conf.py