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.
This commit is contained in:
John W Higgins 2020-04-23 13:43:51 -07:00
parent 00998d053d
commit d1f78cf6d2

View file

@ -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
}