aboutsummaryrefslogtreecommitdiffstats
path: root/pySim
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-10-08 15:47:57 +0200
committerHarald Welte <laforge@osmocom.org>2021-10-14 16:41:57 +0200
commit7cb94e4193fc8646e9b0c86670895451deba8c1f (patch)
treec7e7d7b4f0f29dfe13222de915df106d57c55a4d /pySim
parent846a898ee025111f736513af492c40a9063abe09 (diff)
USIM: Add ENVELOPE and ENVELOPE-SMS shell commands
Diffstat (limited to 'pySim')
-rw-r--r--pySim/ts_31_102.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py
index f347f67..faf0f38 100644
--- a/pySim/ts_31_102.py
+++ b/pySim/ts_31_102.py
@@ -1089,6 +1089,20 @@ class ADF_USIM(CardADF):
(data, sw) = self._cmd.card._scc.terminal_profile(arg)
self._cmd.poutput('SW: %s, data: %s' % (sw, data))
+ def do_envelope(self, arg):
+ """Send an ENVELOPE command to the card."""
+ (data, sw) = self._cmd.card._scc.envelope(arg)
+ self._cmd.poutput('SW: %s, data: %s' % (sw, data))
+
+ def do_envelope_sms(self, arg):
+ """Send an ENVELOPE command to the card."""
+ tpdu_ie = SMS_TPDU()
+ tpdu_ie.from_bytes(h2b(arg))
+ dev_ids = DeviceIdentities(decoded={'source_dev_id':'network','dest_dev_id':'uicc'})
+ sms_dl = SMSPPDownload(children=[dev_ids, tpdu_ie])
+ (data, sw) = self._cmd.card._scc.envelope(b2h(sms_dl.to_tlv()))
+ self._cmd.poutput('SW: %s, data: %s' % (sw, data))
+
# TS 31.102 Section 7.3
sw_usim = {