crypto: show both sha1 and sha256 fingerprints

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-07-03 19:24:39 +02:00
parent 086a8753c0
commit d07704fdf1
6 changed files with 37 additions and 9 deletions

View File

@ -97,7 +97,8 @@ class CertificateKeyPairSerializer(ModelSerializer):
fields = [ fields = [
"pk", "pk",
"name", "name",
"fingerprint", "fingerprint_sha256",
"fingerprint_sha1",
"certificate_data", "certificate_data",
"key_data", "key_data",
"cert_expiry", "cert_expiry",

View File

@ -68,12 +68,19 @@ class CertificateKeyPair(CreatedUpdatedModel):
return self._private_key return self._private_key
@property @property
def fingerprint(self) -> str: def fingerprint_sha256(self) -> str:
"""Get SHA256 Fingerprint of certificate_data""" """Get SHA256 Fingerprint of certificate_data"""
return hexlify(self.certificate.fingerprint(hashes.SHA256()), ":").decode( return hexlify(self.certificate.fingerprint(hashes.SHA256()), ":").decode(
"utf-8" "utf-8"
) )
@property
def fingerprint_sha1(self) -> str:
"""Get SHA1 Fingerprint of certificate_data"""
return hexlify(self.certificate.fingerprint(hashes.SHA1()), ":").decode(
"utf-8"
)
@property @property
def kid(self): def kid(self):
"""Get Key ID used for JWKS""" """Get Key ID used for JWKS"""

View File

@ -18637,7 +18637,10 @@ components:
title: Kp uuid title: Kp uuid
name: name:
type: string type: string
fingerprint: fingerprint_sha256:
type: string
readOnly: true
fingerprint_sha1:
type: string type: string
readOnly: true readOnly: true
cert_expiry: cert_expiry:
@ -18660,7 +18663,8 @@ components:
- cert_expiry - cert_expiry
- cert_subject - cert_subject
- certificate_download_url - certificate_download_url
- fingerprint - fingerprint_sha1
- fingerprint_sha256
- name - name
- pk - pk
- private_key_available - private_key_available

View File

@ -488,8 +488,12 @@ msgid "Certificate"
msgstr "Certificate" msgstr "Certificate"
#: src/pages/crypto/CertificateKeyPairListPage.ts #: src/pages/crypto/CertificateKeyPairListPage.ts
msgid "Certificate Fingerprint" msgid "Certificate Fingerprint (SHA1)"
msgstr "Certificate Fingerprint" msgstr "Certificate Fingerprint (SHA1)"
#: src/pages/crypto/CertificateKeyPairListPage.ts
msgid "Certificate Fingerprint (SHA256)"
msgstr "Certificate Fingerprint (SHA256)"
#: src/pages/crypto/CertificateKeyPairListPage.ts #: src/pages/crypto/CertificateKeyPairListPage.ts
msgid "Certificate Subjet" msgid "Certificate Subjet"

View File

@ -484,7 +484,11 @@ msgid "Certificate"
msgstr "" msgstr ""
#: #:
msgid "Certificate Fingerprint" msgid "Certificate Fingerprint (SHA1)"
msgstr ""
#:
msgid "Certificate Fingerprint (SHA256)"
msgstr "" msgstr ""
#: #:

View File

@ -103,10 +103,18 @@ export class CertificateKeyPairListPage extends TablePage<CertificateKeyPair> {
<dl class="pf-c-description-list pf-m-horizontal"> <dl class="pf-c-description-list pf-m-horizontal">
<div class="pf-c-description-list__group"> <div class="pf-c-description-list__group">
<dt class="pf-c-description-list__term"> <dt class="pf-c-description-list__term">
<span class="pf-c-description-list__text">${t`Certificate Fingerprint`}</span> <span class="pf-c-description-list__text">${t`Certificate Fingerprint (SHA1)`}</span>
</dt> </dt>
<dd class="pf-c-description-list__description"> <dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text">${item.fingerprint}</div> <div class="pf-c-description-list__text">${item.fingerprintSha1}</div>
</dd>
</div>
<div class="pf-c-description-list__group">
<dt class="pf-c-description-list__term">
<span class="pf-c-description-list__text">${t`Certificate Fingerprint (SHA256)`}</span>
</dt>
<dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text">${item.fingerprintSha256}</div>
</dd> </dd>
</div> </div>
<div class="pf-c-description-list__group"> <div class="pf-c-description-list__group">