Attention is currently required from: laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/27127 )
Change subject: Better decode of EF.UST, EF.EST and EF.IST
......................................................................
Patch Set 2:
(1 comment)
File pySim/ts_31_102.py:
https://gerrit.osmocom.org/c/pysim/+/27127/comment/554738c8_5bb690fb
PS2, Line 536: (int, int)
This looks wrong. Should be:
Tuple[int, int]
(make sure that you have Tuple imported from typing)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27127
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I34f64d1043698dc385619b2fdda23cb541675f76
Gerrit-Change-Number: 27127
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Thu, 10 Feb 2022 13:36:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/27124 )
Change subject: Makefile: run $(nproc) parallel jobs for target 'deps'
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/27124
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I53112a20d78d12bcc2764c1fc5567eb26bfa46cc
Gerrit-Change-Number: 27124
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 10 Feb 2022 13:32:28 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/27129 )
Change subject: ts_102_221: Handle nested security condition data objects
......................................................................
Patch Set 1: Code-Review-1
(4 comments)
Patchset:
PS1:
CR-1 due to non-existing '++' operator.
File pySim/ts_102_221.py:
https://gerrit.osmocom.org/c/pysim/+/27129/comment/dd3716c5_a707e707
PS1, Line 479: def from_bytes(self, binary:bytes):
Missing type hint:
-> list
https://gerrit.osmocom.org/c/pysim/+/27129/comment/0930b7e7_ca64a633
PS1, Line 486: def to_bytes(self):
Missing type hint:
-> bytes
https://gerrit.osmocom.org/c/pysim/+/27129/comment/acfaf1d3_640866c6
PS1, Line 489: ++
Looks like you meant '+=' here? This could be done simpler:
encoded = [self.children.encode(e) for e in self.decoded]
return b''.join(encoded)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27129
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Icb09cf3a90303a86fc77406b8b0806b5c926f1be
Gerrit-Change-Number: 27129
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Thu, 10 Feb 2022 13:22:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/27130 )
Change subject: ts_102_221: Implement proper parsing of EF.DIR
......................................................................
ts_102_221: Implement proper parsing of EF.DIR
EF.DIR can not only contain the AID + Label of TS 102 221, but can
also contain any of the DOs specified in ISO7816-4. Let's imoplement
this based on the modern pySim.tlv parser
Change-Id: I875eb49e1f0370428c2eae69af84f5483bd5b1fc
Closes: OS#5410
---
A pySim/iso7816_4.py
M pySim/ts_102_221.py
2 files changed, 76 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/30/27130/1
diff --git a/pySim/iso7816_4.py b/pySim/iso7816_4.py
new file mode 100644
index 0000000..ea838cf
--- /dev/null
+++ b/pySim/iso7816_4.py
@@ -0,0 +1,62 @@
+# coding=utf-8
+"""Utilities / Functions related to ISO 7816-4
+
+(C) 2022 by Harald Welte <laforge(a)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
diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py
index 88855bf..d35ebe1 100644
--- a/pySim/ts_102_221.py
+++ b/pySim/ts_102_221.py
@@ -22,10 +22,12 @@
from pySim.construct import *
from pySim.utils import *
from pySim.filesystem import *
+from pySim.tlv import *
from bidict import bidict
from pySim.profile import CardProfile
from pySim.profile import match_uicc
from pySim.profile import match_sim
+import pySim.iso7816_4 as iso7816_4
# A UICC will usually also support 2G functionality. If this is the case, we
# need to add DF_GSM and DF_TELECOM along with the UICC related files
@@ -504,18 +506,20 @@
# TS 102 221 Section 13.1
class EF_DIR(LinFixedEF):
+ class ApplicationLabel(BER_TLV_IE, tag=0x50):
+ # TODO: UCS-2 coding option as per Annex A of TS 102 221
+ _construct = GreedyString('ascii')
+
+ class ApplicationTemplate(BER_TLV_IE, tag=0x61,
+ nested=[iso7816_4.ApplicationId, ApplicationLabel, iso7816_4.FileReference,
+ iso7816_4.CommandApdu, iso7816_4.DiscretionaryData,
+ iso7816_4.DiscretionaryTemplate, iso7816_4.URL,
+ iso7816_4.ApplicationRelatedDOSet]):
+ pass
+
def __init__(self, fid='2f00', sfid=0x1e, name='EF.DIR', desc='Application Directory'):
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={5,54})
-
- def _decode_record_hex(self, raw_hex_data):
- raw_hex_data = raw_hex_data.upper()
- atempl_base_tlv = TLV(['61'])
- atempl_base = atempl_base_tlv.parse(raw_hex_data)
- atempl_TLV_MAP = {'4F': 'aid_value', 50:'label'}
- atempl_tlv = TLV(atempl_TLV_MAP)
- atempl = atempl_tlv.parse(atempl_base['61'])
- # FIXME: "All other Dos are according to ISO/IEC 7816-4"
- return tlv_key_replace(atempl_TLV_MAP, atempl)
+ self._tlv = EF_DIR.ApplicationTemplate
# TS 102 221 Section 13.2
class EF_ICCID(TransparentEF):
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27130
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I875eb49e1f0370428c2eae69af84f5483bd5b1fc
Gerrit-Change-Number: 27130
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange