MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / PublicKeyFingerprint

Function PublicKeyFingerprint

pkg/certs/selfsigned.go:95–98  ·  view source on GitHub ↗

PublicKeyFingerprint returns the hex-encoded SHA-256 digest of the certificate's SubjectPublicKeyInfo. It depends only on the public key, so two certificates that share a key produce the same fingerprint. Note that the operator generates a fresh key on every restart, so its fingerprint is not stable

(cert *x509.Certificate)

Source from the content-addressed store, hash-verified

93// share a key produce the same fingerprint. Note that the operator generates a fresh
94// key on every restart, so its fingerprint is not stable across restarts.
95func PublicKeyFingerprint(cert *x509.Certificate) string {
96 digest := sha256.Sum256(cert.RawSubjectPublicKeyInfo)
97 return hex.EncodeToString(digest[:])
98}

Callers 4

middleware_test.goFile · 0.92
withOperatorAuthMethod · 0.92
selfsigned_test.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected