-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
This commit is contained in:
oepen
2011-07-29 18:16:55 +00:00
parent 97722f937d
commit 65a8acaae3
2 changed files with 9 additions and 6 deletions

View File

@@ -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

View File

@@ -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:]