Commit Graph

80 Commits

Author SHA1 Message Date
Harald Welte 2c219cd706 docs/shell: Give users some hints on what to do if encoding/decoding fails
Change-Id: I557991da748126f3585b88b27706b29e0264635b
Related: OS#6385
2024-03-11 12:55:29 +01:00
Harald Welte 1432af5150 Add terminal_capability command to send TERMINAL CAPABILITY
TS 102 221 specifies a TERMINAL CAPABILITY command using which the
terminal (Software + hardware talking to the card) can expose their
capabilities.  This is also used in the eUICC universe to let the eUICC
know which features are supported.

Change-Id: Iaeb8b4c34524edbb93217bf401e466399626e9b0
2024-02-12 18:59:54 +01:00
Harald Welte 2bb2ff4aeb global_platform: INSTALL [for install] support
Change-Id: I4c1da90f1aa8ad9609602272f374078d1e1faa11
2024-02-05 01:41:49 +01:00
Harald Welte af8826a02b Implement Global Platform SCP03
This adds an implementation of the GlobalPlatform SCP03 protocol. It has
been tested in S8 mode for C-MAC, C-ENC, R-MAC and R-ENC with AES using
128, 192 and 256 bit key lengh.  Test vectors generated while talking to
a sysmoEUICC1-C2T are included as unit tests.

Change-Id: Ibc35af5474923aed2e3bcb29c8d713b4127a160d
2024-02-04 17:56:59 +01:00
Harald Welte bdf8419966 global_platform: add delete_key and delete_card_content
This GlobalPlatform command is used to delete applications/load-files
or keys.

Change-Id: Ib5d18e983d0e918633d7c090c54fb9a3384a22e5
2024-02-04 17:56:59 +01:00
Harald Welte a7eaefc8d9 global_platform: add set_status command
Using this command, one can change the life cycle status of on-card
applications, specifically one can LOCK (disable) them and re-enable
them as needed.

Change-Id: Ie14297a119d01cad1284f315a2508aa92cb4633b
2024-02-04 17:56:59 +01:00
Harald Welte 4d5fd25f31 global_platform: Add install_for_personalization command
This allows us to perform STORE DATA on applications like ARA-M/ARA-D
after establishing SCP02 to the related security domain.

Change-Id: I2ce766b97bba42c64c4d4492b505be66c24f471e
2024-02-04 17:56:59 +01:00
Harald Welte 41a7379a4f Introduce GlobalPlatform SCP02 implementation
This implementation of GlobalPlatform SCP02 currently only supports
C-MAC and C-ENC, but no R-MAC or R-ENC yet.

The patch also introduces the notion of having a SCP instance associated
with a SimCardCommands instance.  It also adds the establish_scp0w and
release_scp shell commands to all GlobalPlatform Security Domains.

Change-Id: I56020382b9dfe8ba0f7c1c9f71eb1a9746bc5a27
2024-02-04 17:42:30 +01:00
Harald Welte 5918345c78 global_platform: implement GET STATUS command
The GlobalPlatform GET STATUS command is used to display information
about ISD / Applications / ExecutabLoad Files / Modules on the card.

Change-Id: Ic92f96c1c6a569aebc93a906c62a43b86fe3b811
2024-01-31 22:24:42 +01:00
Harald Welte 8a39d00cc3 osmo-smdpp: Support multiple different profiles
Let's simply use the matchingId for filesystem lookup of the UPP file.

This way we can have any number of profiles by simply creating the
respeective files.

Change-Id: I0bc3a14b9fdfcc6322917dd0c69d8295de486950
2024-01-30 21:33:41 +01:00
Harald Welte 18d0a7de96 global_platform: Add shell command for PUT KEY
This command is used for installation of GlobalPlatform keys.  We only
implement the command without secure messaging at this point, as it is
used during card personalization.  Authentication will later be handled
by generic implementations of SCP02 and/or SCP03.

Change-Id: Icffe9e7743266d7262fbf440dd361b21eed7c5cf
2024-01-25 19:16:57 +01:00
Harald Welte 280a9a3408 docs: Add missing global_platform store_data command docs
In If30c5d31b4e7dd60d3a5cfb1d1cbdcf61741a50e we introduced a store_data
comamnd, but forgot to add it to the pySim-shell manual.

Change-Id: I6039818c2c0c5373b4a4ef1e33e152de7fbbd01a
2024-01-25 19:16:57 +01:00
Harald Welte 6dadb6c215 docs: Update osmo-smdpp with pointer to sysmoEUICC1-C2T and SGP.26
Change-Id: Id031ca48549a3c2ac21c93a169262570843d8e2d
2024-01-25 19:16:57 +01:00
Harald Welte cd18ed0a82 ts_102_221: Better explain 'selected file invalidated'
Some specs call it 'invalidated', others call it 'deactivated'.  If the
user is unfamiliar with this, the error message about "invalidated"
might not be obvious enough; let's also mention 'deactivated' in the
message and explicitly mention that it needs to be activated before use.

Change-Id: I91488b0e7dc25a8970022b09e575485a4165eefa
2024-01-16 19:04:10 +01:00
Harald Welte 5bbb144a31 Initial proof-of-concept SM-DP+ for GSMA consumer eSIM RSP
This commit introduces

* the program implementing the main procedures and the
  HTTP/REST based ES9+
* python modules for ES8+ and non-volatile RSP Session State storage
* the ASN.1 source files required to parse/encode RSP
* 3GPP test certificates from SGP.26
* an unsigned profile package (UPP) of a SAIP v2.3 TS48 test profile

As I couldn't get the 'Klein' tls support to work, the SM-DP+ code
currently does not support HTTPS/TLS but plan HTTP, so you either have
to modify your LPA to use HTTP instead of HTTPS, or put a TLS proxy in

I have successfully installed an eSIM profile on a test eUICC that
contains certificate/key data within the test CI defined in GSMA SGP.26

Change-Id: I6232847432dc6920cd2bd08c84d7099c29ca1c11
2024-01-09 21:37:12 +00:00
Harald Welte e76fae9c4c pySim-shell: Update manual with examples for using with eUICC ISD-R
Change-Id: I4a0acdad5c7478ee76f92c7610c0e2a5331dea46
2024-01-08 20:56:32 +00:00
Harald Welte 188869568a docs/shell: extend the introduction part; link to video presentation
Change-Id: I77c30921f2b8c002c9dda244656c348c96b41f06
2023-12-23 09:14:59 +00:00
Harald Welte 469db9393f pySim-shell: Use argparser for verify_adm to support --help
Let's add a proper argparser instance for the 'verify_adm' command,
avoiding situations where the user types 'verif_adm --help' and then
--help is interpreted as the PIN value, removing one more attempt from
the failed ADM1 counter.

Let's use that opportunity to improve the documentation of the command.

Change-Id: I3321fae66a11efd00c53b66c7890fce84796e658
2023-11-02 21:46:38 +00:00
Harald Welte 0ba3fd996a pySim-shell: Add copyright statement and link to online manual to banner
This way the users are reminded where they can go to read the manual.

Change-Id: Ie86822e73bccb3c585cecc818d4462d4ca6e43c2
2023-11-02 21:46:13 +00:00
Harald Welte 3d16fdd8da docs: shell: Various documentation updates/extensions
* examples for export, verify_adm, reset, apdu
* explain CSV option for verify_adm
* fix 'tree' example (--help shouldn't be there)

Change-Id: I6ed8d8c5cf268ad3534e988eff9501f388b8d80f
2023-11-02 21:46:08 +00:00
Harald Welte aa07ebcdac docs: shell: update output in examples
pySim-shell output has changed over time, so some examples were
showing outdated content.  Let's update those.

Change-Id: I4058719c32b61689522e90eba37253e8accb8ba5
2023-11-02 21:46:01 +00:00
Harald Welte 0c25e922be docs: shell: Re-order the command sections/classes
the generic pysim command should precede those from specs like ISO7816

Change-Id: I11e66757f10cc28fda547244ae09d51dacd70824
2023-11-02 21:45:48 +00:00
Harald Welte 350cfd822b docs: shell: link to cmd2 documentation
Change-Id: I532cb33781f95fe847db7fae7a5264b5d9c416de
2023-11-02 21:44:46 +00:00
Harald Welte 0f2faa59fb docs: shell: By now we have encoders/decoders for most files
Change-Id: Ia771f9969ae7eb0094d1768af3f7f54cc9d0d581
2023-11-01 17:26:35 +01:00
Harald Welte 47bb33f937 docs: shell: Clarify various different card support
Change-Id: Ibf8e3538aa3c954df72c11ec0a2f885031b54b0e
2023-11-01 17:26:35 +01:00
Harald Welte cbc0bdfaa9 euicc: add some first IoT eUICC commands (GSMA SGP.32)
this is far from being complete, just some basic first commands
to get the certificates and eIM configuration.

Change-Id: Ie05108e635ed9c6de10f0ba431cb1b13893f6be8
2023-10-26 15:16:30 +00:00
Harald Welte 884eb551af euicc: Add get_profiles_info command
Example output:

pySIM-shell (02:MF/ADF.ISD-R)> get_profiles_info
    "profile_info_seq": {
        "profile_info": {
            "iccid": "98940462222222222222",
            "isdp_aid": "a0000005591010ffffffff8900001200",
            "profile_state": "enabled",
            "service_provider_name": "foobar",
            "profile_name": "foobar",
            "profile_class": "provisioning"

Change-Id: I52d136f99dc0eb29905e7ca0cd0865486d3cf65b
2023-10-26 15:16:30 +00:00
Harald Welte 268a2025db Initial support for eUICC
This just adds basic support for the ISD-R application and its
associated STORE DATA command which is used for the ES10x interfaces
between off-card entities and the on-card ISD-R.

Change-Id: Ieab37b083e25d3f36c20f6e9ed3e4bdfdd14a42a
Closes: OS#5637
2023-10-26 15:16:30 +00:00
Harald Welte 237ddb5bb3 pySim-shell: Include current logical channel in prompt
Now that pySim-shell can switch between logical channels, let's state
the currently used logical channel in the prompt.

Change-Id: I45781a6fba205eeb4ac7f58d5cb642b7131bdd88
Related: OS#6230
2023-10-24 15:10:01 +02:00
Harald Welte 20650997e8 pySim-shell: Add 'switch_channel' command
We've already had the 'open_channel' and 'close_channel' commands,
which were sent to (and acknowledged by) the card.  However,
those commands didn't affect the pySim-shell state, i.e. all
communication would still happen through the default channel '0'.

With this patch we introduce a 'switch_channel' command, using which
the user can determine which of the (previously opened) logical channels
shall be used by pySim-shell.

Change-Id: Ia76eb45c4925882ae6866e50b64d9610bd4d546d
Closes: OS#6230
2023-10-24 15:10:01 +02:00
Harald Welte 91eeecfbf3 docs: Fix command reference for 'apdu' command
This fixes the below error during build of the documentation:

pysim/docs/shell.rst:349: ERROR: "<class 'pySim-shell.PySimCommands'>" has no attribute "apdu_cmd_parser"

Change-Id: If89b66a45ea18b5a3fc56bf77b05e679463da5a8
2023-10-23 22:30:31 +02:00
Harald Welte fdcf3c5702 GlobalPlatform ADF.SD: Add command line reference + error message
The get_data shell command didn't have any interactive help / syntax,
and no meaningful error message in case an unknown data object name
was specified by the user.  Let's fix that.

Change-Id: I09faaf5d45118635cf832c8c513033aede1427e5
2023-07-11 08:54:04 +02:00
Harald Welte 7e55569f3a docs: Add section on pySim-trace to user manual
Change-Id: I5edb222818f00e36ed5b067e0f8d5786f39ae887
2023-06-13 15:10:25 +00:00
Harald Welte f422eb1886 Add ".py" suffix to sphinx-argparse generated docs
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
2023-06-09 11:50:18 +02:00
Harald Welte 7ec822373e ts_31_102: Add shell command for GET IDENTITY
GET IDENTITY is used in the "SUCI computation on USIM" feature.

Change-Id: I619d397900dbd6565f8f46acdabcee511903830c
2023-06-07 15:54:17 +00:00
Harald Welte b0e0dce80a ts_102221: Add "resume_uicc" command
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

Change-Id: I3322fde74f680e77954e1d3e18a32ef5662759f2
2023-06-07 11:13:34 +02:00
Harald Welte 659781cbe1 Move "suspend_uicc" command from pySim-shell to
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
2023-06-07 11:10:33 +02:00
Harald Welte 455611c9a3 ts_31_102: Add decoder/encoder for DF.5GS/EF.Routing_Indicator
This file is rather important for 5G SA operation, so we should have
a proper encoder/decoder in place.

Change-Id: I1b37fdfc2807976880b2cafb61951f08eebeb344
2023-06-03 12:45:35 +00:00
Merlin Chlosta 69b69d4d84 docs: add SUPI/SUCI usage example
Change-Id: I2908ea9df7e78c596554731085902e2ab7278328
2023-05-27 12:37:12 +02:00
Harald Welte c224b3b5f1 ts_51_011: Add sst_service_[de]{activate,allocate} shell commands
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
2023-05-25 07:55:44 +00:00
Oliver Smith 308d7cdf78 docs/Makefile: don't forward shrink to sphinx
Adjust the catch-all target at the end of the Makefile that is supposed
to route all unknown targets to sphinx, so it doesn't do this for the
shrink target. The shrink target has recently been added to in osmo-gsm-manuals, which gets included right above
the catch-all target. So it isn't an unknown target, but for some reason
the sphinx catch-all runs in addition to the shrink target (runs, see output below) and fails. As I did not add the
catch-all logic, preserve it but add an exception for the shrink rule.

Fix for:
  + make -C docs publish publish-html
  make: Entering directory '/build/docs'
  /opt/osmo-gsm-manuals/build/ _build/latex/osmopysim-usermanual.pdf
  * _build/latex/osmopysim-usermanual.pdf: 272K (shrunk from 336K)
  Running Sphinx v5.3.0

  Sphinx error:
  Builder name shrink not registered or available through entry point

Related: SYS#6380
Change-Id: If2802bb93909aba90debe5e03f3047cec73e2f54
2023-03-20 12:28:06 +01:00
Harald Welte 0707b80ad3 ts_102_222: Implement support for RESIZE FILE for an EF
This adds pySim-shell support for the RESIZE FILE command in order
to change the size of linear fixed or transparent EF.

Change-Id: I03fbb683e26231c75f345330ac5f914ac88bbe7a
2023-03-09 09:49:40 +00:00
Oliver Smith da1f562294 docs: change upload path for html docs
Upload it to pysim/master/html instead of latest/pysim.

Related: OS#5902
Change-Id: I0b338bd7d1fb2620d63e651eeb8e40c7d8e722e2
2023-03-07 12:44:14 +01:00
Harald Welte a07d509de6 docs: Document the file-specific commands for ADF.USIM/EF.EST
Change-Id: Iddba9f25ba957f03ca25628a7742fe40fd79c030
2023-02-23 10:02:49 +01:00
Harald Welte 577312a04e docs: Add reference for various commands
A number of more recently introduced commands were not yet listed in the
manual, let's fix that.

Change-Id: I39150f55eecb5d8ff48292dc5cc0f9e16dd4398c
2023-02-23 09:52:44 +01:00
Oliver Smith 0529c1906d docs: allow overriding OSMO_GSM_MANUALS_DIR
Related: OS#5497
Change-Id: I433217b7aa1cdcddc52a89721e03e44b417bacb1
2022-10-21 16:24:47 +02:00
Harald Welte aefd0649a2 pySim-shell: Add 'decode_hex' command for transparent + linear EF
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
2022-03-01 16:48:22 +00:00
Harald Welte 12af793d4b doc: Improve documentation in various places
* don't duplicate information between .rst files and docstrings
* if there's more than a trivial single-line documentation, put it as
  docstring into the python source and use ".. argparse" to pul it into
  the manual
* add documentation for some commands for which it was missing
* show one level deeper in the navigation table, listing the commands

Change-Id: Ib88bb7d12faaac7d149ee1f6379bc128b83bbdd5
2022-02-15 16:40:45 +01:00
Harald Welte d01bd3632c docs: Document missing 'status' command in 7816 section
Change-Id: I9af85a36bc4f24c3a22b9b2a6b8e2abd86edfe4e
2022-02-15 15:56:48 +01:00
Harald Welte 799c354827 shell: Proper argparser (for help + manual) activate_file
Change-Id: I5929ae3deff4d15b5db4a1d866576271c57a955f
2022-02-15 15:56:28 +01:00