コード例 #1
0
ファイル: custom.py プロジェクト: ohleck/ePassportViewer
 def setCiphering(self):
     try:
         self.initIso7816()
         KSenc = hexRepToBin(self.customKencForm.get())
         KSmac = hexRepToBin(self.customKmacForm.get())
         ssc = hexRepToBin(self.customSscForm.get())
         sm = securemessaging.SecureMessaging(KSenc, KSmac, ssc)
         self._iso7816.setCiphering(sm)
         self.writeToLog("CIPHERING SET:\n{0}".format(sm))
     except Exception, msg:
         tkMessageBox.showerror("Error: Set ciphering", str(msg))
コード例 #2
0
ファイル: epassport.py プロジェクト: seculting/pypassport
 def doBasicAccessControl(self):
     """
     Execute the basic acces control protocol and set up the secure messaging.
     
     @return: A True if the BAC execute correctly
     @raise bacException: If an error occur during the process
     @raise EPassportException: If the mrz is not initialized.
     """
     if self._mrz == None:
         raise EPassportException("The object must be initialized with the ePassport MRZ")
     
     (KSenc, KSmac, ssc) = self._bac.authenticationAndEstablishmentOfSessionKeys(self._mrz)
     sm = securemessaging.SecureMessaging(KSenc, KSmac, ssc) 
     sm.register(self._logFct)
     return self._iso7816.setCiphering(sm)
コード例 #3
0
ファイル: custom.py プロジェクト: ohleck/ePassportViewer
 def performBAC(self):
     try:
         if self.mrz.buildMRZ():
             self.reset()
             self.init()
             basic_access_control = bac.BAC(self._iso7816)
             (
                 KSenc, KSmac, ssc
             ) = basic_access_control.authenticationAndEstablishmentOfSessionKeys(
                 mrz.MRZ(self.mrz.buildMRZ()))
             sm = securemessaging.SecureMessaging(KSenc, KSmac, ssc)
             self._iso7816.setCiphering(sm)
             self.writeToLog("CIPHERING SET:\n{0}".format(sm))
         else:
             tkMessageBox.showerror("Error: BAC",
                                    "You have to set the proper MRZ first")
     except Exception, msg:
         tkMessageBox.showerror("Error: BAC", str(msg))