cards: add method to modify APDU parameters (cla, sel_ctrl)

There are situations where it is necessary to modify the class byte and
the selection control bytes of a card at runtime. This should not be
done by accessing the properties of the _scc object directly. The
modification of those properties should be done via a set method
instead.

Change-Id: Ifd8aa2660e44a18d28945d070419612eff443e78
This commit is contained in:
Philipp Maier 2021-10-29 16:41:46 +02:00
parent 51e4cb7a8f
commit 30b225f3bf
1 changed files with 9 additions and 0 deletions

View File

@ -302,6 +302,15 @@ class SimCard(object):
len = self._scc.record_size(ef)
self._scc.update_record(ef, rec_no, "ff" * len, force_len=False, verify=True)
def set_apdu_parameter(self, cla, sel_ctrl):
"""Set apdu parameters (class byte and selection control bytes)"""
self._scc.cla_byte = cla
self._scc.sel_ctrl = sel_ctrl
def get_apdu_parameter(self):
"""Get apdu parameters (class byte and selection control bytes)"""
return (self._scc.cla_byte, self._scc.sel_ctrl)
class UsimCard(SimCard):
name = 'USIM'