def _calculate(self, credential, timestamp, password_key):
     dev = self._descriptor.open_device(TRANSPORT.CCID)
     controller = OathController(dev.driver)
     if controller.locked and password_key is not None:
         controller.validate(a2b_hex(password_key))
     cred = controller.calculate(credential, timestamp)
     return cred
Exemple #2
0
 def calculate(self, credential, timestamp):
     try:
         dev = self._descriptor.open_device(TRANSPORT.CCID)
         controller = OathController(dev.driver)
         self._unlock(controller)
     except Exception:
         return None
     code = controller.calculate(cred_from_dict(credential), timestamp)
     return code_to_dict(code)
Exemple #3
0
 def calculate(self, credential, timestamp):
     try:
         dev = self._descriptor.open_device(TRANSPORT.CCID)
         controller = OathController(dev.driver)
         self._unlock(controller)
     except Exception:
         return None
     code = controller.calculate(cred_from_dict(credential), timestamp)
     return code_to_dict(code)
Exemple #4
0
 def calculate(self, credential, timestamp, password_key):
     try:
         dev = self._descriptor.open_device(TRANSPORT.CCID)
         controller = OathController(dev.driver)
         if controller.locked and password_key is not None:
             controller.validate(a2b_hex(password_key))
     except:
         return None
     return controller.calculate(Credential.from_dict(credential),
                                 timestamp).to_dict()