aboutsummaryrefslogtreecommitdiffstats
path: root/cards/tcos_card.py
diff options
context:
space:
mode:
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)