blob: 0adafba9d2ccfe815bdf89d422c57803fd72ad0b [file] [log] [blame]
Harald Weltee6191052023-06-06 10:32:46 +02001# -*- coding: utf-8 -*-
2
3"""
4Support 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
23from pySim.filesystem import *
24from pySim.utils import *
25from pySim.tlv import *
26from pySim.ts_31_102 import ADF_USIM
27from pySim.ts_51_011 import EF_IMSI, EF_AD
28import pySim.ts_102_221
29from pySim.ts_102_221 import EF_ARR
30
31
32class 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
51sw_hpsim = {
52 'Security management': {
53 '9862': 'Authentication error, incorrect MAC',
54 }
55}
56
57
58class CardApplicationHPSIM(CardApplication):
59 def __init__(self):
60 super().__init__('HPSIM', adf=ADF_HPSIM(), sw=sw_hpsim)