@@ -62,6 +62,8 @@ class URLS:
6262 CERTIFICATE_IMPORT = API_BASE_URL + "certificates/import"
6363 ZONE_CONFIG = API_BASE_URL + "certificates/checkpolicy"
6464 CONFIG_READ_DN = API_BASE_URL + "Config/ReadDn"
65+ CONFIG_DN_TO_GUID = API_BASE_URL + "Config/DnToGuid"
66+ CONFIG_GUID_TO_DN = API_BASE_URL + "Config/GuidToDn"
6567
6668 POLICY_IS_VALID = API_BASE_URL + "config/isvalid"
6769 POLICY_CREATE = API_BASE_URL + "config/create"
@@ -326,6 +328,27 @@ def renew_cert(self, request, reuse_key=False):
326328 raise CertificateRequestError
327329
328330 def revoke_cert (self , request ):
331+ if not (request .id or request .thumbprint ):
332+ raise ClientBadData
333+ d = dict ()
334+ if request .id :
335+ d ['CertificateDN' ] = request .id
336+ elif request .thumbprint :
337+ d ['Thumbprint' ] = request .thumbprint
338+ else :
339+ raise ClientBadData
340+ req_args = {
341+ 'url' : URLS .CERTIFICATE_REVOKE ,
342+ 'data' : d
343+ }
344+ # TODO: Change _post() with post(args)
345+ status , data = self ._post (URLS .CERTIFICATE_REVOKE , data = d )
346+ if status in (HTTPStatus .OK , HTTPStatus .ACCEPTED ):
347+ return data
348+
349+ raise ServerUnexptedBehavior
350+
351+ def retire_cert (self , request ):
329352 if not (request .id or request .thumbprint ):
330353 raise ClientBadData
331354 d = {
@@ -348,6 +371,7 @@ def revoke_cert(self, request):
348371
349372 raise ServerUnexptedBehavior
350373
374+
351375 def import_cert (self , request ):
352376 raise NotImplementedError
353377
@@ -1064,3 +1088,28 @@ def validate_identity(self, prefixed_universal):
10641088 status , response = self ._post (URLS .POLICY_VALIDATE_IDENTITY , data = data )
10651089 identity = build_identity_entry (response ['ID' ])
10661090 return identity
1091+
1092+ def get_certificate_guid_from_dn (self , cert_dn ):
1093+ request_data = {
1094+ 'ObjectDN' : cert_dn
1095+ }
1096+ args = {
1097+ self .ARG_URL : URLS .CONFIG_DN_TO_GUID ,
1098+ self .ARG_DATA : request_data
1099+ }
1100+ status , response = self .post (args )
1101+ cert_guid = response (['GUID' ])
1102+ return cert_guid
1103+
1104+ def get_certificate_dn_from_guid (self , cert_guid ):
1105+ request_data = {
1106+ 'ObjectGUID' : cert_guid
1107+ }
1108+ args = {
1109+ self .ARG_URL : URLS .CONFIG_GUID_TO_DN ,
1110+ self .ARG_DATA : request_data
1111+ }
1112+ status , response = self .post (args )
1113+ cert_dn = response (['ObjectDN' ])
1114+ return cert_dn
1115+
0 commit comments