From d1f78cf6d27ad50b816a2989a9330263581f75f1 Mon Sep 17 00:00:00 2001 From: John W Higgins Date: Thu, 23 Apr 2020 13:43:51 -0700 Subject: [PATCH] Add root fingerprint to pki if certificate given If a root certificate is provided to init an authority the fingerprint is not currently stored in the default.json file. This patch simply stores the fingerprint of the supplied certificate. --- pki/pki.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pki/pki.go b/pki/pki.go index c7c5ec1c..d52f247e 100644 --- a/pki/pki.go +++ b/pki/pki.go @@ -289,6 +289,10 @@ func (p *PKI) WriteRootCertificate(rootCrt *x509.Certificate, rootKey interface{ if err != nil { return err } + + sum := sha256.Sum256(rootCrt.Raw) + p.rootFingerprint = strings.ToLower(hex.EncodeToString(sum[:])) + return nil }