From c411deeb2ebdfde2338228c612d8b99e1b56df19 Mon Sep 17 00:00:00 2001 From: psytester Date: Mon, 19 May 2014 21:43:08 +0200 Subject: [PATCH] VirtualSmartcard new option for dataset pass dataset file to CardGenerator --- .../src/vpicc/virtualsmartcard/VirtualSmartcard.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/VirtualSmartcard.py b/virtualsmartcard/src/vpicc/virtualsmartcard/VirtualSmartcard.py index 902e075..33eddf4 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/VirtualSmartcard.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/VirtualSmartcard.py @@ -629,7 +629,7 @@ class VirtualICC(object): the vpcd, which forwards it to the application. """ - def __init__(self, filename, card_type, host, port, readernum=None, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, cvca=None, disable_checks=False, logginglevel=logging.INFO): + def __init__(self, filename, datasetfile, card_type, host, port, readernum=None, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, cvca=None, disable_checks=False, logginglevel=logging.INFO): from os.path import exists logging.basicConfig(level = logginglevel, @@ -647,7 +647,17 @@ class VirtualICC(object): else: logging.info("Creating new card which will be saved in %s.", self.filename) - + + #If a dataset file is specified, read the card's data groups from disk + if datasetfile != None: + if exists(datasetfile): + logging.info("Reading Data Groups from file %s.", + datasetfile) + self.cardGenerator.readDatagroups(datasetfile) + else: + logging.info("Data Set File %s not found, using default values for datagroups.", + self.datasetfile) + MF, SAM = self.cardGenerator.getCard() #Generate an OS object of the correct card_type