コード例 #1
0
 def openpgp_get_remaining_pin_retries(self):
     try:
         with self._open_device(TRANSPORT.CCID) as dev:
             controller = OpgpController(dev.driver)
             return controller.get_remaining_pin_tries()
     except Exception as e:
         logger.error('Failed to get remaining OpenPGP PIN retries',
                      exc_info=e)
         return None
コード例 #2
0
 def openpgp_reset(self):
     try:
         with self._open_device(TRANSPORT.CCID) as dev:
             controller = OpgpController(dev.driver)
             controller.reset()
             return True
     except Exception as e:
         logger.error('Failed to reset OpenPGP applet', exc_info=e)
         return False
コード例 #3
0
 def openpgp_get_touch(self):
     try:
         with self._open_device(TRANSPORT.CCID) as dev:
             controller = OpgpController(dev.driver)
             auth = controller.get_touch(KEY_SLOT.AUTHENTICATE)
             enc = controller.get_touch(KEY_SLOT.ENCRYPT)
             sig = controller.get_touch(KEY_SLOT.SIGN)
             return [auth, enc, sig]
     except Exception as e:
         logger.error('Failed to get OpenPGP touch policy', exc_info=e)
         return None
コード例 #4
0
 def openpgp_set_pin_retries(self, admin_pin, pin_retries,
                             reset_code_retries, admin_pin_retries):
     try:
         with self._open_device(TRANSPORT.CCID) as dev:
             controller = OpgpController(dev.driver)
             controller.set_pin_retries(int(pin_retries),
                                        int(reset_code_retries),
                                        int(admin_pin_retries),
                                        admin_pin.encode())
             return True
     except Exception as e:
         logger.error('Failed to set OpenPGP PIN retries', exc_info=e)
         return False
コード例 #5
0
 def openpgp_get_version(self):
     try:
         with self._open_device(TRANSPORT.CCID) as dev:
             controller = OpgpController(dev.driver)
             return controller.version
     except Exception as e:
         logger.error('Failed to get OpenPGP applet version', exc_info=e)
         return None
コード例 #6
0
 def openpgp_set_touch(self, admin_pin, auth, enc, sig):
     try:
         with self._open_device(TRANSPORT.CCID) as dev:
             controller = OpgpController(dev.driver)
             if auth >= 0:
                 controller.set_touch(KEY_SLOT.AUTHENTICATE, int(auth),
                                      admin_pin.encode())
             if enc >= 0:
                 controller.set_touch(KEY_SLOT.ENCRYPT, int(enc),
                                      admin_pin.encode())
             if sig >= 0:
                 controller.set_touch(KEY_SLOT.SIGN, int(sig),
                                      admin_pin.encode())
             return True
     except Exception as e:
         logger.error('Failed to set OpenPGP touch policy', exc_info=e)
         return False
コード例 #7
0
ファイル: test_opgp.py プロジェクト: nevun/yubikey-manager
 def setUpClass(cls):
     with open_device()[0] as conn:
         controller = OpgpController(SmartCardProtocol(conn))
         controller.reset()
コード例 #8
0
ファイル: test_opgp.py プロジェクト: nevun/yubikey-manager
 def reconnect(self):
     self.conn.close()
     self.conn = open_device()[0]
     self.controller = OpgpController(SmartCardProtocol(self.conn))
コード例 #9
0
ファイル: test_opgp.py プロジェクト: nevun/yubikey-manager
 def setUp(self):
     self.conn = open_device()[0]
     self.controller = OpgpController(SmartCardProtocol(self.conn))
コード例 #10
0
ファイル: test_opgp.py プロジェクト: xfalcox/yubikey-manager
 def setUpClass(cls):
     with open_device() as dev:
         controller = OpgpController(dev.driver)
         controller.reset()
コード例 #11
0
ファイル: test_opgp.py プロジェクト: xfalcox/yubikey-manager
 def reconnect(self):
     self.dev.driver.close()
     self.dev = open_device()
     self.controller = OpgpController(self.dev.driver)
コード例 #12
0
ファイル: test_opgp.py プロジェクト: xfalcox/yubikey-manager
 def setUp(self):
     self.dev = open_device()
     self.controller = OpgpController(self.dev.driver)