From c504b8912a200de4331e9e65fb99ac720f9574dd Mon Sep 17 00:00:00 2001 From: Edoardo Putti Date: Fri, 23 Sep 2016 16:04:01 +0200 Subject: [PATCH] implement GET in CALookup API --- ca_manager.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ca_manager.py b/ca_manager.py index f4522ce..009e1ea 100755 --- a/ca_manager.py +++ b/ca_manager.py @@ -202,6 +202,20 @@ class CALookup(object): """ Get a specific certification authority from the database """ + c = self.conn.cursor() + c.execute("""SELECT name, type FROM cas WHERE id = ?""", (ca_id, )) + + result = c.fetchone() + if not result: + raise ValueError('Unknown CA "%s"' % ca_id) + + ca_name, ca_type = result + + if ca_type.lower() == 'ssh': + return SSHAuthority(ca_id, ca_name, self.ssh_ca_dir) + + elif ca_type.lower() == 'ssl': + return SSLAuthority(ca_id, ca_name, self.ssl_ca_dir) def __setitem__(self, ca_id, ca_value): """