From eac459fe24223fc8b456ee07c56a639efb0ae598 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 12 Feb 2024 11:19:55 +0100 Subject: [PATCH] ts_31_102: Add support for "USIM supporting non-IMSI SUPI Type" This type of USIM was introduced in Release 16.4. It is basically a copy of ADF.USIM without the EF.IMSI file and a dedicated AID. Change-Id: Ifcde27873a398273a89889bb38537f79859383e9 --- pySim/ts_31_102.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py index 0ddf2184..25366037 100644 --- a/pySim/ts_31_102.py +++ b/pySim/ts_31_102.py @@ -10,7 +10,7 @@ Various constants from 3GPP TS 31.102 V17.9.0 # # Copyright (C) 2020 Supreeth Herle -# Copyright (C) 2021-2023 Harald Welte +# Copyright (C) 2021-2024 Harald Welte # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -1443,14 +1443,13 @@ class DF_SAIP(CardDF): class ADF_USIM(CardADF): def __init__(self, aid='a0000000871002', has_fs=True, name='ADF.USIM', fid=None, sfid=None, - desc='USIM Application'): + desc='USIM Application', has_imsi=True): super().__init__(aid=aid, has_fs=has_fs, fid=fid, sfid=sfid, name=name, desc=desc) # add those commands to the general commands of a TransparentEF self.shell_commands += [self.AddlShellCommands()] files = [ EF_LI(sfid=0x02), - EF_IMSI(sfid=0x07), EF_Keys(), EF_Keys('6f09', 0x09, 'EF.KeysPS', desc='Ciphering and Integrity Keys for PS domain'), @@ -1571,6 +1570,10 @@ class ADF_USIM(CardADF): DF_5G_ProSe(service=139), DF_SAIP(), ] + + if has_imsi: + files.append(EF_IMSI(sfid=0x07)) + self.add_files(files) def decode_select_response(self, data_hex): @@ -1666,3 +1669,10 @@ sw_usim = { class CardApplicationUSIM(CardApplication): def __init__(self): super().__init__('USIM', adf=ADF_USIM(), sw=sw_usim) + +# TS 31.102 Annex N + TS 102 220 Annex E +class CardApplicationUSIMnonIMSI(CardApplication): + def __init__(self): + adf = ADF_USIM(aid='a000000087100b', name='ADF.USIM-non-IMSI', has_imsi=False, + desc='3GPP USIM (non-IMSI SUPI Type) - TS 31.102 Annex N') + super().__init__('USIM-non-IMSI', adf=adf, sw=sw_usim)