Support client certificate import

In addition, add getters for certificate fields,
and ensure certificate object has short lifespan, since
it might change in storage

Change-Id: I2abbec0e48d82d432c9cc18afaca62bae7558d7c
This commit is contained in:
Anna Khmelnitsky
2017-01-18 14:25:55 -08:00
parent 76b47c2bb7
commit 763f024ab8
4 changed files with 160 additions and 41 deletions

View File

@@ -30,8 +30,8 @@ class NsxLibTrustManagement(utils.NsxLibApiBase):
"""
lines = pem.split(b'\n')
result = lines[0] + b'\n'
result += b''.join(lines[1:-1])
result += b'\n' + lines[-1]
result += b''.join(lines[1:-2])
result += b'\n' + lines[-2]
return result
def create_cert(self, cert_pem):
@@ -43,6 +43,10 @@ class NsxLibTrustManagement(utils.NsxLibApiBase):
# should be only one result
return results[0]['id']
def get_cert(self, cert_id):
resource = CERT_SECTION + '/' + cert_id
return self.client.get(resource)
def delete_cert(self, cert_id):
resource = CERT_SECTION + '/' + cert_id
self.client.delete(resource)