VirtualSmartcard new option for dataset

pass dataset file to CardGenerator
This commit is contained in:
psytester
2014-05-19 21:43:08 +02:00
parent c070394f82
commit c411deeb2e

View File

@@ -629,7 +629,7 @@ class VirtualICC(object):
the vpcd, which forwards it to the application. 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 from os.path import exists
logging.basicConfig(level = logginglevel, logging.basicConfig(level = logginglevel,
@@ -648,6 +648,16 @@ class VirtualICC(object):
logging.info("Creating new card which will be saved in %s.", logging.info("Creating new card which will be saved in %s.",
self.filename) 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() MF, SAM = self.cardGenerator.getCard()
#Generate an OS object of the correct card_type #Generate an OS object of the correct card_type