aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSupreeth Herle <herlesupreeth@gmail.com>2020-04-01 08:37:47 +0200
committerSupreeth Herle <herlesupreeth@gmail.com>2020-04-01 09:14:04 +0200
commitd21349a61077a02529cd5109adcf54f4d326e6ff (patch)
tree7eae22640b4671d4d21d5aeaca67a6b7d41c9112
parentc7f2f7413be44212d37feda093537d93f25c0546 (diff)
cards.py: Add generic function to read EF binary to card class
This is a generic function applicable for reading EFs which doesnt require further processing such as GID1, GID2 etc while decoding and also to avoid code duplication. Change-Id: If3d8fdddb26f9776c89fd442d1d95b83e0d1476b
-rw-r--r--pySim/cards.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pySim/cards.py b/pySim/cards.py
index 495d3ee..7d3b7b4 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -145,6 +145,10 @@ class Card(object):
data, sw = self._scc.update_binary(EF['SPN'], rpad(content, 32))
return sw
+ def read_binary(self, ef, length=None, offset=0):
+ ef_path = ef in EF and EF[ef] or ef
+ return self._scc.read_binary(ef_path, length, offset)
+
def read_gid1(self):
(res, sw) = self._scc.read_binary(EF['GID1'])
if sw == '9000':