From 30b225f3bfceb48451f7b6775b4f7271833bfd19 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Fri, 29 Oct 2021 16:41:46 +0200 Subject: [PATCH] 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 --- pySim/cards.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pySim/cards.py b/pySim/cards.py index 1a86b14e..4511271e 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -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'