aboutsummaryrefslogtreecommitdiffstats
path: root/cards/iso_7816_4_card.py
diff options
context:
space:
mode:
authorhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2007-02-10 21:52:06 +0000
committerhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2007-02-10 21:52:06 +0000
commit82cddea7e7bdd15a9c80a13e5c8a80259c8d4aa3 (patch)
tree08e15abe57234dc6b0e5dc77a91b6e8544e2b3d5 /cards/iso_7816_4_card.py
parenta4efadb3776691af55dfb25aae02bbc1b27dfa84 (diff)
Add support for aliases in application selection
Add skeleton for support of application specific commands that can be dynamically loaded Pending addition of commands to work with passports git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@173 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'cards/iso_7816_4_card.py')
-rw-r--r--cards/iso_7816_4_card.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/cards/iso_7816_4_card.py b/cards/iso_7816_4_card.py
index ed61943..8df1304 100644
--- a/cards/iso_7816_4_card.py
+++ b/cards/iso_7816_4_card.py
@@ -1,5 +1,6 @@
import TLV_utils
from generic_card import *
+from generic_application import Application
class ISO_7816_4_Card(Card):
APDU_SELECT_APPLICATION = C_APDU(ins=0xa4,p1=0x04)
@@ -122,13 +123,18 @@ class ISO_7816_4_Card(Card):
result = self.send_apdu(
C_APDU(self.APDU_SELECT_APPLICATION,
data = aid, le = 0) ) ## FIXME With or without le
+ if result.sw == self.SW_OK:
+ Application.load_applications(self, aid)
return result
def cmd_selectapplication(self, application):
"""Select an application on the card.
application can be given either as hexadecimal aid or by symbolic name (if known)."""
- s = [a for a,b in self.APPLICATIONS.items() if b[0] is not None and b[0].lower() == application.lower()]
+ s = [a for a,b in self.APPLICATIONS.items()
+ if (b[0] is not None and b[0].lower() == application.lower())
+ or (len(b) > 2 and application.lower() in [c.lower() for c in b[2].get("alias", [])])
+ ]
if len(s) > 0:
aid = s[0]
else: