Beispiel #1
0
    def __init__(self, reader, epMrz=None):
        """ 
        This object provide most of the functionnalities described in the EPassport document.
            - The basic acces control + secure messaging
            - The active authentication
            - The passive authentication
            - Reading of the various dataGroups
        
        @param reader: It can be a reader or a path to dumps
        @type reader: A reader object, then it will use the specified rfid reader. 
                      A string, then the simulator will read the dumps from the specified url.  
        
        @param mrz: An object representing the passport MRZ.
        @type mrz: An MRZ object 
        """
        logger.Logger.__init__(self, "EPassport")

        if epMrz:
            self._mrz = mrz.MRZ(epMrz)
            if self._mrz.checkMRZ() == False:
                raise EPassportException("Invalid MRZ")
        else:
            self._mrz = None

        self._iso7816 = iso7816.Iso7816(reader)
        self._iso7816.register(self._logFct)

        self._dgReader = datagroup.DataGroupReaderFactory().create(
            self._iso7816)
        self._dgReader.register(self._logFct)

        self._bac = bac.BAC(self._iso7816)
        self._bac.register(self._logFct)

        self._openSSL = openssl.OpenSSL()
        self._openSSL.register(self._logFct)

        self._aa = activeauthentication.ActiveAuthentication(
            self._iso7816, self._openSSL)
        self._aa.register(self._logFct)

        self._pa = passiveauthentication.PassiveAuthentication(self._openSSL)
        self._pa.register(self._logFct)

        self._CSCADirectory = None
        self._selectPassportApp()
ISSUER = "BEL"                        #3 chars
NAME = "Smith"
SURNAME = "John"#39 chars for both n and fn
NATIONALITY = "BEL"                   #3 chars
SEX = "M"                             #1 char
PASSPORT_NUM = "EH123456"             #9 chars
BIRTH_DATE = "031085"                 #6 chars
EXPIRY_DATE = "070815"                #6 chars

ISSUE_DATA = "11072009"                 #6 chars
IMAGE_PATH = "C:/jf.jpg"
SIGNATURE_PATH = "C:/jfSignature.jpg"
BIRTH_PLACE = "Huy"
AUTHORITY = "MODAVE"  

o = openssl.OpenSSL()
o.register(trace)        
       
if not CREATE_CERT:
    f = open(WORKING_DIR + "\\csca")
    csca = f.read()
    f.close()
    f = open(WORKING_DIR + "\\cscaKey")
    cscaKey = f.read()
    f.close()
    f = open(WORKING_DIR + "\\ds")
    ds = f.read()
    f.close()
    f = open(WORKING_DIR + "\\dsKey")
    dsKey = f.read()
    f.close()