Harald Welte | 181c7c5 | 2022-02-10 14:18:32 +0100 | [diff] [blame] | 1 | # coding=utf-8 |
| 2 | """Utilities / Functions related to ISO 7816-4 |
| 3 | |
| 4 | (C) 2022 by Harald Welte <laforge@osmocom.org> |
| 5 | |
| 6 | This program is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation, either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | """ |
| 19 | |
| 20 | from construct import * |
| 21 | from pySim.construct import * |
| 22 | from pySim.utils import * |
| 23 | from pySim.filesystem import * |
| 24 | from pySim.tlv import * |
| 25 | |
| 26 | # Table 91 + Section 8.2.1.2 |
| 27 | class ApplicationId(BER_TLV_IE, tag=0x4f): |
| 28 | _construct = GreedyBytes |
| 29 | |
| 30 | # Table 91 |
| 31 | class ApplicationLabel(BER_TLV_IE, tag=0x50): |
| 32 | _construct = GreedyBytes |
| 33 | |
| 34 | # Table 91 + Section 5.3.1.2 |
| 35 | class FileReference(BER_TLV_IE, tag=0x51): |
| 36 | _construct = GreedyBytes |
| 37 | |
| 38 | # Table 91 |
| 39 | class CommandApdu(BER_TLV_IE, tag=0x52): |
| 40 | _construct = GreedyBytes |
| 41 | |
| 42 | # Table 91 |
| 43 | class DiscretionaryData(BER_TLV_IE, tag=0x53): |
| 44 | _construct = GreedyBytes |
| 45 | |
| 46 | # Table 91 |
| 47 | class DiscretionaryTemplate(BER_TLV_IE, tag=0x73): |
| 48 | _construct = GreedyBytes |
| 49 | |
| 50 | # Table 91 + RFC1738 / RFC2396 |
| 51 | class URL(BER_TLV_IE, tag=0x5f50): |
| 52 | _construct = GreedyString('ascii') |
| 53 | |
| 54 | # Table 91 |
| 55 | class ApplicationRelatedDOSet(BER_TLV_IE, tag=0x61): |
| 56 | _construct = GreedyBytes |
| 57 | |
| 58 | # Section 8.2.1.3 Application Template |
| 59 | class ApplicationTemplate(BER_TLV_IE, tag=0x61, nested=[ApplicationId, ApplicationLabel, FileReference, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 60 | CommandApdu, DiscretionaryData, DiscretionaryTemplate, URL, |
Harald Welte | 181c7c5 | 2022-02-10 14:18:32 +0100 | [diff] [blame] | 61 | ApplicationRelatedDOSet]): |
| 62 | pass |