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 = [
"pk",
"name",
"fingerprint",
"fingerprint_sha256",
"fingerprint_sha1",
"certificate_data",
"key_data",
"cert_expiry",

View File

@ -68,12 +68,19 @@ class CertificateKeyPair(CreatedUpdatedModel):
return self._private_key
@property
def fingerprint(self) -> str:
def fingerprint_sha256(self) -> str:
"""Get SHA256 Fingerprint of certificate_data"""
return hexlify(self.certificate.fingerprint(hashes.SHA256()), ":").decode(
"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
def kid(self):
"""Get Key ID used for JWKS"""

View File

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

View File

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

View File

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

View File

@ -103,10 +103,18 @@ export class CertificateKeyPairListPage extends TablePage<CertificateKeyPair> {
<dl class="pf-c-description-list pf-m-horizontal">
<div class="pf-c-description-list__group">
<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>
<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>
</div>
<div class="pf-c-description-list__group">