forked from public/pysim
pySim.apdu: Fix APDU CLA matching
The cla values as hex strings must be compared in case insensitive manner Change-Id: I890bc385d6209e6cfe9b0c38bd9deee7ae50e5f5
This commit is contained in:
@@ -272,7 +272,7 @@ class ApduCommand(Apdu, metaclass=ApduCommandMeta):
|
|||||||
"""Does the given CLA match the CLA list of the command?."""
|
"""Does the given CLA match the CLA list of the command?."""
|
||||||
if not isinstance(cla, str):
|
if not isinstance(cla, str):
|
||||||
cla = '%02X' % cla
|
cla = '%02X' % cla
|
||||||
cla = cla.lower()
|
cla = cla.upper()
|
||||||
# see https://github.com/PyCQA/pylint/issues/7219
|
# see https://github.com/PyCQA/pylint/issues/7219
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
for cla_match in cls._cla:
|
for cla_match in cls._cla:
|
||||||
@@ -282,7 +282,7 @@ class ApduCommand(Apdu, metaclass=ApduCommandMeta):
|
|||||||
cla_masked += 'X'
|
cla_masked += 'X'
|
||||||
else:
|
else:
|
||||||
cla_masked += cla[i]
|
cla_masked += cla[i]
|
||||||
if cla_masked == cla_match:
|
if cla_masked == cla_match.upper():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user