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
This commit is contained in:
Harald Welte
2024-04-07 12:05:28 +02:00
parent 1d1ba8e4cc
commit 57df6f6e68

View File

@@ -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 {}