Support SPKI Fingerprint Pinning

Support SPKI Fingerprint Pinning for TLSObject
This commit is contained in:
Yue Yin authored and yuhan6665 committed 2023-02-24 11:47:00 -05:00
1 parent 267d93f7bd
commit 03b8c094de
6 files changed
+169 -23

No files matched your search

+6
View File
@@ -2,6 +2,7 @@ package tls
import (
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/pem"
)
@@ -34,3 +35,8 @@ func GenerateCertChainHash(rawCerts [][]byte) []byte {
}
return hashValue
}
func GenerateCertPublicKeyHash(cert *x509.Certificate) []byte {
out := sha256.Sum256(cert.RawSubjectPublicKeyInfo)
return out[:]
}