From 28972ee5bef17d344fe892c4539e6466d9821883 Mon Sep 17 00:00:00 2001 From: oepen Date: Fri, 29 Jul 2011 20:40:38 +0000 Subject: [PATCH] Code style improvements git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@467 96b47cad-a561-4643-ad3b-153ac7d7599c --- .../vpicc/virtualsmartcard/CardGenerator.py | 138 ++++++++++-------- 1 file changed, 74 insertions(+), 64 deletions(-) diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py b/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py index 153e777..236539b 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py @@ -17,7 +17,7 @@ # virtualsmartcard. If not, see . # -import sys, getpass, anydbm, readline, os, dircache +import sys, getpass, anydbm, readline, dircache from pickle import loads, dumps from TLVutils import pack from virtualsmartcard.utils import inttostring @@ -36,10 +36,10 @@ from virtualsmartcard.SmartcardFilesystem import * class CardGenerator(object): - def __init__(self, type=None, sam=None, mf=None): - self.type = type - self.mf = None - self.sam = None + def __init__(self, card_type=None, sam=None, mf=None): + self.type = card_type + self.mf = mf + self.sam = sam def __generate_iso_card(self): from virtualsmartcard.SmartcardSAM import SAM @@ -47,80 +47,90 @@ class CardGenerator(object): print "Using default SAM. Insecure!!!" self.sam = SAM("1234", "1234567890") #FIXME: Use user provided data - self.mf = MF(filedescriptor=FDB["DF"], lifecycle=LCB["ACTIVATED"], dfname=None) + self.mf = MF(filedescriptor=FDB["DF"]) self.sam.set_MF(self.mf) def __generate_ePass(self): - from PIL import Image - from virtualsmartcard.SmartcardSAM import PassportSAM + from PIL import Image + from virtualsmartcard.SmartcardSAM import PassportSAM - MRZ = raw_input("Please enter the MRZ as one string: ") #TODO: Sanity checks - - readline.set_completer_delims("") - readline.parse_and_bind("tab: complete") - - picturepath = raw_input("Please enter the path to an image: ") - picturepath = picturepath.rstrip() #FIXME - - #MRZ1 = "P