aboutsummaryrefslogtreecommitdiffstats
path: root/cards/tcos_card.py
diff options
context:
space:
mode:
authorhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2007-02-12 16:41:19 +0000
committerhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2007-02-12 16:41:19 +0000
commit617a1693b67bf9e6b8aacab30259c5f40d350974 (patch)
treee4f028705cc97c5a8eff92c5035d83842919463b /cards/tcos_card.py
parent52fb65dc5d0a8162c5083609bd96487e2643f20a (diff)
Move parse_fancy_apdu from Cyberflex_Shell to utils.C_APDU
Extract actual MAC computation from tcos_card.TCOS_Security_Environment for later overriding in passport_application.Passport_Security_Environment git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@175 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'cards/tcos_card.py')
-rw-r--r--cards/tcos_card.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/cards/tcos_card.py b/cards/tcos_card.py
index 760a67a..1c49c91 100644
--- a/cards/tcos_card.py
+++ b/cards/tcos_card.py
@@ -304,11 +304,7 @@ class TCOS_Security_Environment(object):
if len(block) > 0:
do_block(buffer, block)
- cct = crypto_utils.cipher( True,
- self.get_cipherspec(config),
- self.get_key(config),
- "".join(buffer),
- self.get_iv(config) )[-8:]
+ cct = self._mac("".join(buffer))
if print_buffer:
print "| Result (Tag 0x8e, length: 0x%02x):" % len(cct)
@@ -316,6 +312,13 @@ class TCOS_Security_Environment(object):
return cct
+ def _mac(self, data):
+ return crypto_utils.cipher( True,
+ self.get_cipherspec(config),
+ self.get_key(config),
+ data,
+ self.get_iv(config) )[-8:]
+
def authenticate_command(self, apdu, tlv_data):
config = self.get_config(SE_APDU, TEMPLATE_CCT)