From 65a8acaae3c06357a72f0abe3a2cf26b1bc66125 Mon Sep 17 00:00:00 2001 From: oepen Date: Fri, 29 Jul 2011 18:16:55 +0000 Subject: [PATCH] -Bugfix: Added missing import in PassportSAM -Bugfix: Fixed constant names in SEutils git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@460 96b47cad-a561-4643-ad3b-153ac7d7599c --- virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py | 6 ++++-- .../src/vpicc/virtualsmartcard/SmartcardSAM.py | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py b/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py index 6443c6f..ddf7cc7 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py @@ -19,7 +19,7 @@ import TLVutils from time import time from random import seed, randint -from virtualsmartcard.ConstantDefinitions import * +from virtualsmartcard.ConstantDefinitions import CRT_TEMPLATE from virtualsmartcard.utils import inttostring, stringtoint from virtualsmartcard.SWutils import * @@ -30,7 +30,9 @@ class ControlReferenceTemplate: @param type: Type of the CRT (HT, AT, KT, CCT, DST, CT-sym, CT-asym) @param config: A string containing TLV encoded Security Environment parameters """ - if type not in (TEMPLATE_AT, TEMPLATE_HT, TEMPLATE_KAT, TEMPLATE_CCT, TEMPLATE_DST, TEMPLATE_CT): + if type not in (CRT_TEMPLATE["AT"], CRT_TEMPLATE["HT"], + CRT_TEMPLATE["KAT"], CRT_TEMPLATE["CCT"], + CRT_TEMPLATE["DST"], CRT_TEMPLATE["CT"]): raise ValueError, "Unknown control reference tag." else: self.type = type diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py b/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py index 3b13431..1316369 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py @@ -20,7 +20,7 @@ import random, struct, hashlib from pickle import dumps, loads -import SmartcardFilesystem, TLVutils +import TLVutils import virtualsmartcard.CryptoUtils as vsCrypto from virtualsmartcard.SWutils import SwError, SW from virtualsmartcard.utils import inttostring, stringtoint, hexdump, C_APDU @@ -66,7 +66,7 @@ class CardContainer: self.cardNumber = cardNumber self.PIN = PIN self.FSkeys = {} - self.cipher = 0x01 #Algorithm reference for __get_referenced_algorithm(p1) + self.cipher = 0x01 self.master_password = None self.master_key = None self.salt = None @@ -385,8 +385,9 @@ class SAM(object): class PassportSAM(SAM): def __init__(self, mf): - - ef_dg1 = virtualsmartcard.SmartcardFilesystem.walk(mf, "\x00\x04\x01\x01") + import virtualsmartcard.SmartcardFilesystem as vsFS + + ef_dg1 = vsFS.walk(mf, "\x00\x04\x01\x01") dg1 = ef_dg1.readbinary(5) self.mrz1 = dg1[:43] self.mrz2 = dg1[44:]