Attention is currently required from: dexter, laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35440?usp=email )
Change subject: Fix enumeration of GlobbalPlatformISDR during card_init()
......................................................................
Patch Set 1:
(1 comment)
File pySim/global_platform.py:
https://gerrit.osmocom.org/c/pysim/+/35440/comment/98c6e6a5_f0f8d0c1
PS1, Line 262: intermediate = False
> Something that only exists in CardApplicationSD but not any derived classes.
This can be done by making `intermediate` private by renaming it to `__intermediate`.
This prefix makes fields and methods somewhat special:
```
class Parent:
# this field can be accessed as self.__intermediate by methods of this class,
# but not by methods of child classes and not from the outside
__intermediate = True
class Child(Parent):
pass
>>> Parent.__intermediate # yields AttributeError
>>> Child.__intermediate # yields AttributeError
>>> Parent._Parent__intermediate # True
>>> Child._Parent__intermediate # True
>>> Child._Child__intermediate # yields AttributeError
```
As can be seen, `Child` class still does inherit field `__intermediate`, but Python prepends the parent class name to it. So you can use this when iterating over the sub-classes of `CardApplication`:
```
if hasattr(app_cls, '_' + app_cls.__name__ + '__intermediate'):
continue # skip intermediate classes
```
See also: https://stackoverflow.com/questions/20261517/inheritance-of-private-and-pro….
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35440?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7fb1637f8f7a149b536c4d77dac92736c526aa6c
Gerrit-Change-Number: 35440
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 27 Dec 2023 16:01:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: comment
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35450?usp=email )
Change subject: global_platform: Add support for key types of v2.3.1 (including AES)
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35450?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iae30f18435c2b0a349bfd9240b9c7cca06674534
Gerrit-Change-Number: 35450
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 27 Dec 2023 15:40:52 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35449?usp=email )
Change subject: global_platform: Add TLV test data for Key Information Data
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35449?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ib7b73cb28abea98986a66264a0779263873d7fb2
Gerrit-Change-Number: 35449
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 27 Dec 2023 15:40:46 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35448?usp=email )
Change subject: global_platform: Correctly decode Key Information Data
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35448?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Icf367827d62ed67afa27ee3d0ba9d5cd5bc65c99
Gerrit-Change-Number: 35448
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 27 Dec 2023 15:40:43 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/35447?usp=email )
Change subject: tlv: Fix from_dict() symmetry
......................................................................
tlv: Fix from_dict() symmetry
the to_dict() method generates a {class_name: value} dictionary,
for both the nested and non-nested case. However, before this patch,
the from_dict() method expects a plain list of child IE dicts
in the nested case. This is illogical.
Let's make sure from_dict always expectes a {class_name: value} dict
for both nested and non-nested situations.
Change-Id: I07e4feb3800b420d8be7aae8911f828f1da9dab8
---
M pySim/tlv.py
1 file changed, 21 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/pySim/tlv.py b/pySim/tlv.py
index 6ea7dd1..4ac5ebf 100644
--- a/pySim/tlv.py
+++ b/pySim/tlv.py
@@ -157,13 +157,13 @@
def from_dict(self, decoded: dict):
"""Set the IE internal decoded representation to data from the argument.
If this is a nested IE, the child IE instance list is re-created."""
+ expected_key_name = camel_to_snake(type(self).__name__)
+ if not expected_key_name in decoded:
+ raise ValueError("Dict %s doesn't contain expected key %s" % (decoded, expected_key_name))
if self.nested_collection:
- self.children = self.nested_collection.from_dict(decoded)
+ self.children = self.nested_collection.from_dict(decoded[expected_key_name])
else:
self.children = []
- expected_key_name = camel_to_snake(type(self).__name__)
- if not expected_key_name in decoded:
- raise ValueError("Dict %s doesn't contain expected key %s" % (decoded, expected_key_name))
self.decoded = decoded[expected_key_name]
def is_constructed(self):
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35447?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I07e4feb3800b420d8be7aae8911f828f1da9dab8
Gerrit-Change-Number: 35447
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged