From 57df6f6e6856c5633816a901dda3d17e77fcce18 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 7 Apr 2024 12:05:28 +0200 Subject: [PATCH] filesystem: Enforce lower-case hex AID our utils.b2h() returns values in lower-case hex string notation, so let's make sure the CardADF and CardApplication AID values are also stored in lower case notation, othewise the matching baesd on AIDs returned from the card will not work, specifically as we use uppercase AIDs in pySim.euicc for CardApplicationECASD and CardApplicationISDR. Rather than change those two instances, let's solve it in a generic way. We already do the same for the CardFile.fid member. Change-Id: Ie42392412d9eb817fbc563d9165faab198ffa7a9 --- pySim/filesystem.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pySim/filesystem.py b/pySim/filesystem.py index 4d5fde92..77482cc1 100644 --- a/pySim/filesystem.py +++ b/pySim/filesystem.py @@ -512,7 +512,7 @@ class CardADF(CardDF): super().__init__(**kwargs) # reference to CardApplication may be set from CardApplication constructor self.application = None # type: Optional[CardApplication] - self.aid = aid # Application Identifier + self.aid = aid.lower() # Application Identifier self.has_fs = has_fs # Flag to tell whether the ADF supports a filesystem or not mf = self.get_mf() if mf: @@ -1294,6 +1294,8 @@ class CardApplication: adf : ADF name sw : Dict of status word conversions """ + if aid: + aid = aid.lower() self.name = name self.adf = adf self.sw = sw or {}