Commit 4733e8cd authored by Łukasz Nowak's avatar Łukasz Nowak

Allow to revoke certificate known by CN.

parent ee8ae47e
......@@ -249,4 +249,19 @@ class CertificateAuthorityTool(BaseTool):
finally:
self._unlockCertificateAuthority()
def _getValidSerial(self, common_name):
index = open(self.index).read().splitlines()
valid_line_list = [q for q in index if q.startswith('V') and
('CN=%s' % common_name in q)]
if len(valid_line_list) != 1:
raise ValueError('No certificate for %r' % common_name)
return valid_line_list[0].split('\t')[3]
security.declareProtected(Permissions.AccessContentsInformation,
'revokeCertificate')
def revokeCertificateByCommonName(self, common_name):
self._checkCertificateAuthority()
serial = self._getValidSerial(common_name)
self.revokeCertificate(serial)
InitializeClass(CertificateAuthorityTool)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment