mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-16 18:38:32 +03:00
We had a mixture of tab and 4space based indenting, which is a bad idea. 4space is the standard in python, so convert all our code to that. The result unfortuantely still shoed even more inconsistencies, so I've decided to run autopep8 on the entire code base. Change-Id: I4a4b1b444a2f43fab05fc5d2c8a7dd6ddecb5f07
81 lines
1.9 KiB
Python
81 lines
1.9 KiB
Python
# coding=utf-8
|
|
"""Utilities / Functions related to ISO 7816-4
|
|
|
|
(C) 2022 by Harald Welte <laforge@osmocom.org>
|
|
|
|
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
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
"""
|
|
|
|
from construct import *
|
|
from pySim.construct import *
|
|
from pySim.utils import *
|
|
from pySim.filesystem import *
|
|
from pySim.tlv import *
|
|
|
|
# Table 91 + Section 8.2.1.2
|
|
|
|
|
|
class ApplicationId(BER_TLV_IE, tag=0x4f):
|
|
_construct = GreedyBytes
|
|
|
|
# Table 91
|
|
|
|
|
|
class ApplicationLabel(BER_TLV_IE, tag=0x50):
|
|
_construct = GreedyBytes
|
|
|
|
# Table 91 + Section 5.3.1.2
|
|
|
|
|
|
class FileReference(BER_TLV_IE, tag=0x51):
|
|
_construct = GreedyBytes
|
|
|
|
# Table 91
|
|
|
|
|
|
class CommandApdu(BER_TLV_IE, tag=0x52):
|
|
_construct = GreedyBytes
|
|
|
|
# Table 91
|
|
|
|
|
|
class DiscretionaryData(BER_TLV_IE, tag=0x53):
|
|
_construct = GreedyBytes
|
|
|
|
# Table 91
|
|
|
|
|
|
class DiscretionaryTemplate(BER_TLV_IE, tag=0x73):
|
|
_construct = GreedyBytes
|
|
|
|
# Table 91 + RFC1738 / RFC2396
|
|
|
|
|
|
class URL(BER_TLV_IE, tag=0x5f50):
|
|
_construct = GreedyString('ascii')
|
|
|
|
# Table 91
|
|
|
|
|
|
class ApplicationRelatedDOSet(BER_TLV_IE, tag=0x61):
|
|
_construct = GreedyBytes
|
|
|
|
# Section 8.2.1.3 Application Template
|
|
|
|
|
|
class ApplicationTemplate(BER_TLV_IE, tag=0x61, nested=[ApplicationId, ApplicationLabel, FileReference,
|
|
CommandApdu, DiscretionaryData, DiscretionaryTemplate, URL,
|
|
ApplicationRelatedDOSet]):
|
|
pass
|