laforge has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/pysim/+/38943?usp=email )
Change subject: contrib/esim-qrcode.py: Small command line tool to encode eSIM QR codes
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38943?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7983de79937124cc258efd459c51f812f5fa79cb
Gerrit-Change-Number: 38943
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 27 Nov 2024 07:12:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: dexter.
fixeria has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/osmo-bsc/+/38957?usp=email )
Change subject: pcu_sock: do not receive a TXT ind. with PCU_VERSION for a specific BTS
......................................................................
Patch Set 3: Code-Review+1
(1 comment)
File src/osmo-bsc/pcu_sock.c:
https://gerrit.osmocom.org/c/osmo-bsc/+/38957/comment/11826e0d_02b11a73?usp… :
PS3, Line 729: ENSURE_BTS_OBJECT
Maybe move it below the `CHECK_IF_MSG_SIZE`? Checking prim size first looks more logical.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/38957?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I3fbf5430db8b8ea29efb147bd162706990453fc5
Gerrit-Change-Number: 38957
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 26 Nov 2024 21:05:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38912?usp=email )
Change subject: esim.saip.ProfileElementUSIM: Fix IMSI decode if [only] template based
......................................................................
esim.saip.ProfileElementUSIM: Fix IMSI decode if [only] template based
In case the fileDescriptor of EF.IMSI is purely template based and only
the file content is given in the actual profile, we must pass a template
reference to the File() constructor before we can read the IMSI.
This fixes the following exception for some profiles:
ValueError: File(ef-imsi): No fileDescriptor found in tuple, and none set by template before
Change-Id: I14157a7b62ccd9b5b42de9b8060f2ebc5f91ebb3
---
M pySim/esim/saip/__init__.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 2552c8e..64ea7cb 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -1130,7 +1130,8 @@
@property
def imsi(self) -> Optional[str]:
- f = File('ef-imsi', self.decoded['ef-imsi'])
+ template = templates.ProfileTemplateRegistry.get_by_oid(self.templateID)
+ f = File('ef-imsi', self.decoded['ef-imsi'], template.files_by_pename.get('ef-imsi', None))
return dec_imsi(b2h(f.body))
class ProfileElementOptUSIM(FsProfileElement):
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38912?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I14157a7b62ccd9b5b42de9b8060f2ebc5f91ebb3
Gerrit-Change-Number: 38912
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38939?usp=email )
Change subject: docs: Add documentation about contrib/sim-rest-{server,client}
......................................................................
docs: Add documentation about contrib/sim-rest-{server,client}
Those programs have been around since 2021 but we never had any
documentation here. Let's fix that.
Change-Id: I7c471cac9500db063a0c8f5c5eb7b6861b3234ed
---
M docs/index.rst
A docs/sim-rest.rst
2 files changed, 119 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
jolly: Looks good to me, but someone else must approve
diff --git a/docs/index.rst b/docs/index.rst
index bcbc7f0..228fb79 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -43,6 +43,7 @@
legacy
library
osmo-smdpp
+ sim-rest
Indices and tables
diff --git a/docs/sim-rest.rst b/docs/sim-rest.rst
new file mode 100644
index 0000000..41a6d1d
--- /dev/null
+++ b/docs/sim-rest.rst
@@ -0,0 +1,118 @@
+sim-rest-server
+===============
+
+Sometimes there are use cases where a [remote] application will need
+access to a USIM for authentication purposes. This is, for example, in
+case an IMS test client needs to perform USIM based authentication
+against an IMS core.
+
+The pysim repository contains two programs: `sim-rest-server.py` and
+`sim-rest-client.py` that implement a simple approach to achieve the
+above:
+
+`sim-rest-server.py` speaks to a [usually local] USIM via the PC/SC
+API and provides a high-level REST API towards [local or remote]
+applications that wish to perform UMTS AKA using the USIM.
+
+`sim-rest-client.py` implements a small example client program to
+illustrate how the REST API provided by `sim-rest-server.py` can be
+used.
+
+REST API Calls
+--------------
+
+POST /sim-auth-api/v1/slot/SLOT_NR
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+where SLOT_NR is the integer-encoded slot number (corresponds to PC/SC
+reader number). When using a single sysmoOCTSIM board, this is in the range of 0..7
+
+Example: `/sim-auth-api/v1/slot/0` for the first slot.
+
+Request Body
+############
+
+The request body is a JSON document, comprising of
+ 1. the RAND and AUTN parameters as hex-encoded string
+ 2. the application against which to authenticate (USIM, ISIM)
+
+Example:
+::
+
+ {
+ "rand": "bb685a4b2fc4d697b9d6a129dd09a091",
+ "autn": "eea7906f8210000004faf4a7df279b56"
+ }
+
+HTTP Status Codes
+#################
+
+HTTP status codes are used to represent errors within the REST server
+and the SIM reader hardware. They are not used to communicate protocol
+level errors reported by the SIM Card. An unsuccessful authentication
+will hence have a `200 OK` HTTP Status code and then encode the SIM
+specific error information in the Response Body.
+
+====== =========== ================================
+Status Code Description
+------ ----------- --------------------------------
+200 OK Successful execution
+400 Bad Request Request body is malformed
+404 Not Found Specified SIM Slot doesn't exist
+410 Gone No SIM card inserted in slot
+====== =========== ================================
+
+Response Body
+#############
+
+The response body is a JSON document, either
+
+#. a successful outcome; encoding RES, CK, IK as hex-encoded string
+#. a sync failure; encoding AUTS as hex-encoded string
+#. errors
+ #. authentication error (incorrect MAC)
+ #. authentication error (security context not supported)
+ #. key freshness failure
+ #. unspecified card error
+
+Example (succcess):
+::
+
+ {
+ "successful_3g_authentication": {
+ "res": "b15379540ec93985",
+ "ck": "713fde72c28cbd282a4cd4565f3d6381",
+ "ik": "2e641727c95781f1020d319a0594f31a",
+ "kc": "771a2c995172ac42"
+ }
+ }
+
+Example (re-sync case):
+::
+
+ {
+ "synchronisation_failure": {
+ "auts": "dc2a591fe072c92d7c46ecfe97e5"
+ }
+ }
+
+Concrete example using the included sysmoISIM-SJA2
+--------------------------------------------------
+
+This was tested using SIMs ending in IMSI numbers 45890...45899
+
+The following command were executed successfully:
+
+Slot 0
+::
+
+ $ /usr/local/src/pysim/contrib/sim-rest-client.py -c 1 -n 0 -k 841EAD87BC9D974ECA1C167409357601 -o 3211CACDD64F51C3FD3013ECD9A582A0
+ -> {'rand': 'fb195c7873b20affa278887920b9dd57', 'autn': 'd420895a6aa2000089cd016f8d8ae67c'}
+ <- {'successful_3g_authentication': {'res': '131004db2ff1ce8e', 'ck': 'd42eb5aa085307903271b2422b698bad', 'ik': '485f81e6fd957fe3cad374adf12fe1ca', 'kc': '64d3f2a32f801214'}}
+
+Slot 1
+::
+
+ $ /usr/local/src/pysim/contrib/sim-rest-client.py -c 1 -n 1 -k 5C2CE9633FF9B502B519A4EACD16D9DF -o 9834D619E71A02CD76F00CC7AA34FB32
+ -> {'rand': '433dc5553db95588f1d8b93870930b66', 'autn': '126bafdcbe9e00000026a208da61075d'}
+ <- {'successful_3g_authentication': {'res': '026d7ac42d379207', 'ck': '83a90ba331f47a95c27a550b174c4a1f', 'ik': '31e1d10329ffaf0ca1684a1bf0b0a14a', 'kc': 'd15ac5b0fff73ecc'}}
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38939?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7c471cac9500db063a0c8f5c5eb7b6861b3234ed
Gerrit-Change-Number: 38939
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Attention is currently required from: jolly.
laforge has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/pysim/+/38939?usp=email )
Change subject: docs: Add documentation about contrib/sim-rest-{server,client}
......................................................................
Patch Set 3: Code-Review+2
(1 comment)
File docs/sim-rest.rst:
https://gerrit.osmocom.org/c/pysim/+/38939/comment/f495f283_96689a78?usp=em… :
PS3, Line 102: 45890
> Is it ok to revile keys of these sim cards here?
valid point. I presume I was using cards that I only used for my internal development at the time this documentation was written (years ago, just never as part of this manual).
As the change is now in gerrit, it's too late now anyway...
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38939?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7c471cac9500db063a0c8f5c5eb7b6861b3234ed
Gerrit-Change-Number: 38939
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Comment-Date: Tue, 26 Nov 2024 20:28:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: jolly <andreas(a)eversberg.eu>