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
diff --git a/pySim/cards.py b/pySim/cards.py
index 1a86b14..4511271 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -302,6 +302,15 @@
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'