Expose full certificate RFC 4514 Distinguished Name string
Using rfc4514_string() method added in cryptography version 2.5.
This commit is contained in:
parent
4842bb0880
commit
4b893ab5b4
|
@ -227,6 +227,10 @@ class Certificate(db.Model):
|
||||||
def location(self):
|
def location(self):
|
||||||
return defaults.location(self.parsed_cert)
|
return defaults.location(self.parsed_cert)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def distinguished_name(self):
|
||||||
|
return self.parsed_cert.subject.rfc4514_string()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def key_type(self):
|
def key_type(self):
|
||||||
if isinstance(self.parsed_cert.public_key(), rsa.RSAPublicKey):
|
if isinstance(self.parsed_cert.public_key(), rsa.RSAPublicKey):
|
||||||
|
|
|
@ -206,6 +206,7 @@ class CertificateOutputSchema(LemurOutputSchema):
|
||||||
|
|
||||||
cn = fields.String()
|
cn = fields.String()
|
||||||
common_name = fields.String(attribute='cn')
|
common_name = fields.String(attribute='cn')
|
||||||
|
distinguished_name = fields.String()
|
||||||
|
|
||||||
not_after = fields.DateTime()
|
not_after = fields.DateTime()
|
||||||
validity_end = ArrowDateTime(attribute='not_after')
|
validity_end = ArrowDateTime(attribute='not_after')
|
||||||
|
|
|
@ -83,6 +83,8 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Certificate fields -->
|
<!-- Certificate fields -->
|
||||||
<div class="list-group-item">
|
<div class="list-group-item">
|
||||||
|
<dt>Distinguished Name</dt>
|
||||||
|
<dd>{{ certificate.distinguishedName }}</dd>
|
||||||
<dt>Certificate Authority</dt>
|
<dt>Certificate Authority</dt>
|
||||||
<dd>{{ certificate.authority ? certificate.authority.name : "Imported" }} <span class="text-muted">({{ certificate.issuer }})</span></dd>
|
<dd>{{ certificate.authority ? certificate.authority.name : "Imported" }} <span class="text-muted">({{ certificate.issuer }})</span></dd>
|
||||||
<dt>Serial</dt>
|
<dt>Serial</dt>
|
||||||
|
|
|
@ -619,6 +619,12 @@ def test_certificate_get_body(client):
|
||||||
response_body = client.get(api.url_for(Certificates, certificate_id=1), headers=VALID_USER_HEADER_TOKEN).json
|
response_body = client.get(api.url_for(Certificates, certificate_id=1), headers=VALID_USER_HEADER_TOKEN).json
|
||||||
assert response_body['serial'] == '211983098819107449768450703123665283596'
|
assert response_body['serial'] == '211983098819107449768450703123665283596'
|
||||||
assert response_body['serialHex'] == '9F7A75B39DAE4C3F9524C68B06DA6A0C'
|
assert response_body['serialHex'] == '9F7A75B39DAE4C3F9524C68B06DA6A0C'
|
||||||
|
assert response_body['distinguishedName'] == ('CN=LemurTrust Unittests Class 1 CA 2018,'
|
||||||
|
'O=LemurTrust Enterprises Ltd,'
|
||||||
|
'OU=Unittesting Operations Center,'
|
||||||
|
'C=EE,'
|
||||||
|
'ST=N/A,'
|
||||||
|
'L=Earth')
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("token,status", [
|
@pytest.mark.parametrize("token,status", [
|
||||||
|
|
|
@ -23,7 +23,7 @@ cffi==1.11.5 # via bcrypt, cryptography, pynacl
|
||||||
chardet==3.0.4 # via requests
|
chardet==3.0.4 # via requests
|
||||||
click==7.0 # via flask
|
click==7.0 # via flask
|
||||||
cloudflare==2.1.0
|
cloudflare==2.1.0
|
||||||
cryptography==2.4.2
|
cryptography==2.5
|
||||||
dnspython3==1.15.0
|
dnspython3==1.15.0
|
||||||
dnspython==1.15.0 # via dnspython3
|
dnspython==1.15.0 # via dnspython3
|
||||||
docutils==0.14 # via botocore
|
docutils==0.14 # via botocore
|
||||||
|
|
Loading…
Reference in New Issue