Change in pysim[master]: pySim-shell: Adds support for DEACTIVATE FILE + ACTIVATE FILE

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Apr 12 08:07:54 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/23707 )

Change subject: pySim-shell: Adds support for DEACTIVATE FILE + ACTIVATE FILE
......................................................................

pySim-shell: Adds support for DEACTIVATE FILE + ACTIVATE FILE

Change-Id: I22207dde20f991b0a22dea8f5dd695a0ec99da33
---
M docs/shell.rst
M pySim-shell.py
M pySim/commands.py
3 files changed, 25 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/docs/shell.rst b/docs/shell.rst
index 1072ee8..f2ddba1 100644
--- a/docs/shell.rst
+++ b/docs/shell.rst
@@ -120,6 +120,14 @@
    :module: pySim-shell
    :func: Iso7816Commands.verify_chv_parser
 
+deactivate_file
+~~~~~~~~~~~~~~~
+Deactivate the currently selected file.  This used to be called INVALIDATE in TS 11.11.
+
+
+activate_file
+~~~~~~~~~~~~~
+Activate the currently selected file.  This used to be called REHABILITATE in TS 11.11.
 
 
 pySim commands
diff --git a/pySim-shell.py b/pySim-shell.py
index cfba73f..b2ccb9a 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -403,6 +403,15 @@
 		(data, sw) = self._cmd.card._scc.enable_chv(opts.pin_nr, h2b(pin))
 		self._cmd.poutput("CHV enable successful")
 
+	def do_deactivate_file(self, opts):
+		"""Deactivate the current EF"""
+		fid = self._cmd.rs.selected_file.fid
+		(data, sw) = self._cmd.card._scc.deactivate_file(fid)
+
+	def do_activate_file(self, opts):
+		"""Activate the current EF"""
+		fid = self._cmd.rs.selected_file.fid
+		(data, sw) = self._cmd.card._scc.activate_file(fid)
 
 def parse_options():
 
diff --git a/pySim/commands.py b/pySim/commands.py
index 791b995..2894d31 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -296,6 +296,14 @@
 			ret = {'successful_3g_authentication': data}
 		return (ret, sw)
 
+	def deactivate_file(self):
+		"""Execute DECATIVATE FILE command as per TS 102 221 Section 11.1.14."""
+		return self._tp.send_apdu_constr_checksw(self.cla_byte, '04', '00', '00', None, None, None)
+
+	def activate_file(self):
+		"""Execute ACTIVATE FILE command as per TS 102 221 Section 11.1.15."""
+		return self._tp.send_apdu_constr_checksw(self.cla_byte, '44', '00', '00', None, None, None)
+
 	def reset_card(self):
 		"""Physically reset the card"""
 		return self._tp.reset_card()

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/23707
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I22207dde20f991b0a22dea8f5dd695a0ec99da33
Gerrit-Change-Number: 23707
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210412/54777c0f/attachment.htm>


More information about the gerrit-log mailing list