Change in pysim[master]: cards: select_adf_by_aid: split off aid completion

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/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Nov 16 15:38:50 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/26280 )


Change subject: cards: select_adf_by_aid: split off aid completion
......................................................................

cards: select_adf_by_aid: split off aid completion

The function select_adf_by_aid first searches for the complete AID in
the set of AIDs that were read from EF.DIR. Lets put this task into a
separate helper method

Change-Id: I88447d47bc96d0d4ff5cea694b46e854232cdf86
---
M pySim/cards.py
1 file changed, 11 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/80/26280/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 8f5004e..70c3956 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -278,13 +278,13 @@
 			self._aids = []
 		return self._aids
 
-	def select_adf_by_aid(self, adf="usim"):
-		"""Select ADF.U/ISIM in the Card using its full AID"""
+	def _complete_aid(self, adf="usim"):
+		"""find the complete version of an ADF.U/ISIM AID"""
 		# Find full AID by partial AID:
 		if is_hex(adf):
 			for aid in self._aids:
 				if len(aid) >= len(adf) and adf == aid[0:len(adf)]:
-					return self._scc.select_adf(aid)
+					return aid
 		# Find full AID by application name:
 		elif adf in ["usim", "isim"]:
 			# First (known) halves of the U/ISIM AID
@@ -293,7 +293,14 @@
 			aid_map["isim"] = "a0000000871004"
 			for aid in self._aids:
 				if aid_map[adf] in aid:
-					return self._scc.select_adf(aid)
+					return aid
+		return None
+
+	def select_adf_by_aid(self, adf="usim"):
+		"""Select ADF.U/ISIM in the Card using its full AID"""
+		aid = _complete_aid(self, adf="usim")
+		if aid:
+			return self._scc.select_adf(aid)
 		return (None, None)
 
 	def erase_binary(self, ef):

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I88447d47bc96d0d4ff5cea694b46e854232cdf86
Gerrit-Change-Number: 26280
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211116/3d506d91/attachment.htm>


More information about the gerrit-log mailing list