Harald Welte | e619105 | 2023-06-06 10:32:46 +0200 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | """ |
| 4 | Support for 3GPP TS 31.104 V17.0.0 |
| 5 | """ |
| 6 | |
| 7 | # Copyright (C) 2023 Harald Welte <laforge@osmocom.org> |
| 8 | # |
| 9 | # This program is free software: you can redistribute it and/or modify |
| 10 | # it under the terms of the GNU General Public License as published by |
| 11 | # the Free Software Foundation, either version 2 of the License, or |
| 12 | # (at your option) any later version. |
| 13 | # |
| 14 | # This program is distributed in the hope that it will be useful, |
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | # GNU General Public License for more details. |
| 18 | # |
| 19 | # You should have received a copy of the GNU General Public License |
| 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | # |
| 22 | |
| 23 | from pySim.filesystem import * |
| 24 | from pySim.utils import * |
| 25 | from pySim.tlv import * |
| 26 | from pySim.ts_31_102 import ADF_USIM |
| 27 | from pySim.ts_51_011 import EF_IMSI, EF_AD |
| 28 | import pySim.ts_102_221 |
| 29 | from pySim.ts_102_221 import EF_ARR |
| 30 | |
| 31 | |
| 32 | class ADF_HPSIM(CardADF): |
| 33 | def __init__(self, aid='a000000087100A', name='ADF.HPSIM', fid=None, sfid=None, |
| 34 | desc='HPSIM Application'): |
| 35 | super().__init__(aid=aid, fid=fid, sfid=sfid, name=name, desc=desc) |
| 36 | |
| 37 | files = [ |
| 38 | EF_ARR(fid='6f06', sfid=0x06), |
| 39 | EF_IMSI(fid='6f07', sfid=0x07), |
| 40 | EF_AD(fid='6fad', sfid=0x03), |
| 41 | ] |
| 42 | self.add_files(files) |
| 43 | # add those commands to the general commands of a TransparentEF |
| 44 | self.shell_commands += [ADF_USIM.AddlShellCommands()] |
| 45 | |
| 46 | def decode_select_response(self, data_hex): |
| 47 | return pySim.ts_102_221.CardProfileUICC.decode_select_response(data_hex) |
| 48 | |
| 49 | |
| 50 | # TS 31.104 Section 7.1 |
| 51 | sw_hpsim = { |
| 52 | 'Security management': { |
| 53 | '9862': 'Authentication error, incorrect MAC', |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | |
| 58 | class CardApplicationHPSIM(CardApplication): |
| 59 | def __init__(self): |
| 60 | super().__init__('HPSIM', adf=ADF_HPSIM(), sw=sw_hpsim) |