-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:
@@ -19,7 +19,7 @@
|
|||||||
import TLVutils
|
import TLVutils
|
||||||
from time import time
|
from time import time
|
||||||
from random import seed, randint
|
from random import seed, randint
|
||||||
from virtualsmartcard.ConstantDefinitions import *
|
from virtualsmartcard.ConstantDefinitions import CRT_TEMPLATE
|
||||||
from virtualsmartcard.utils import inttostring, stringtoint
|
from virtualsmartcard.utils import inttostring, stringtoint
|
||||||
from virtualsmartcard.SWutils import *
|
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 type: Type of the CRT (HT, AT, KT, CCT, DST, CT-sym, CT-asym)
|
||||||
@param config: A string containing TLV encoded Security Environment parameters
|
@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."
|
raise ValueError, "Unknown control reference tag."
|
||||||
else:
|
else:
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
import random, struct, hashlib
|
import random, struct, hashlib
|
||||||
from pickle import dumps, loads
|
from pickle import dumps, loads
|
||||||
|
|
||||||
import SmartcardFilesystem, TLVutils
|
import TLVutils
|
||||||
import virtualsmartcard.CryptoUtils as vsCrypto
|
import virtualsmartcard.CryptoUtils as vsCrypto
|
||||||
from virtualsmartcard.SWutils import SwError, SW
|
from virtualsmartcard.SWutils import SwError, SW
|
||||||
from virtualsmartcard.utils import inttostring, stringtoint, hexdump, C_APDU
|
from virtualsmartcard.utils import inttostring, stringtoint, hexdump, C_APDU
|
||||||
@@ -66,7 +66,7 @@ class CardContainer:
|
|||||||
self.cardNumber = cardNumber
|
self.cardNumber = cardNumber
|
||||||
self.PIN = PIN
|
self.PIN = PIN
|
||||||
self.FSkeys = {}
|
self.FSkeys = {}
|
||||||
self.cipher = 0x01 #Algorithm reference for __get_referenced_algorithm(p1)
|
self.cipher = 0x01
|
||||||
self.master_password = None
|
self.master_password = None
|
||||||
self.master_key = None
|
self.master_key = None
|
||||||
self.salt = None
|
self.salt = None
|
||||||
@@ -385,8 +385,9 @@ class SAM(object):
|
|||||||
|
|
||||||
class PassportSAM(SAM):
|
class PassportSAM(SAM):
|
||||||
def __init__(self, mf):
|
def __init__(self, mf):
|
||||||
|
import virtualsmartcard.SmartcardFilesystem as vsFS
|
||||||
|
|
||||||
ef_dg1 = virtualsmartcard.SmartcardFilesystem.walk(mf, "\x00\x04\x01\x01")
|
ef_dg1 = vsFS.walk(mf, "\x00\x04\x01\x01")
|
||||||
dg1 = ef_dg1.readbinary(5)
|
dg1 = ef_dg1.readbinary(5)
|
||||||
self.mrz1 = dg1[:43]
|
self.mrz1 = dg1[:43]
|
||||||
self.mrz2 = dg1[44:]
|
self.mrz2 = dg1[44:]
|
||||||
|
|||||||
Reference in New Issue
Block a user