diff --git a/virtualsmartcard/vpicc/CardGenerator.py b/virtualsmartcard/vpicc/CardGenerator.py index 4924c3f..1f66d85 100644 --- a/virtualsmartcard/vpicc/CardGenerator.py +++ b/virtualsmartcard/vpicc/CardGenerator.py @@ -17,11 +17,11 @@ # virtualsmartcard. If not, see . # -import sys, getpass, anydbm +import sys, getpass, anydbm, readline, os, dircache from pickle import loads, dumps from TLVutils import pack from utils import inttostring -from SmartcardFilesystem import MF, TransparentStructureEF +from SmartcardFilesystem import * # pgp directory #self.mf.append(DF(parent=self.mf, @@ -34,133 +34,164 @@ from SmartcardFilesystem import MF, TransparentStructureEF #self.mf.append(DF(parent=self.mf, #fid=3, dfname='\xa0\x00\x00\x03\x08\x00\x00\x10\x00\x01\x00')) -def generate_iso_card(): - from SmartcardSAM import SAM - - print "Using default SAM. Insecure!!!" - sam = SAM("1234", "1234567890") #FIXME: Use user provided data +class CardGenerator(object): - mf = MF(filedescriptor=FDB["DF"], lifecycle=LCB["ACTIVATED"], dfname=None) - self.SAM.set_MF(self.mf) - - return mf, sam - -def generate_ePass(): - from PIL import Image - from SmartcardFilesystem import DF - from SmartcardSAM import PassportSAM + def __init__(self, type='iso7816', sam=None, mf=None): + types = ['iso7816', 'ePass', 'cryptoflex'] + if not type in types: + raise ValueError, "Unsupported type " % type - MRZ1 = "P