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

+14
View File
@@ -266,6 +266,20 @@ func (c *Config) verifyPeerCert(rawCerts [][]byte, verifiedChains [][]*x509.Cert
}
return newError("peer cert is unrecognized: ", base64.StdEncoding.EncodeToString(hashValue))
}
if c.PinnedPeerCertificatePublicKeySha256 != nil {
for _, v := range verifiedChains {
for _, cert := range v {
publicHash := GenerateCertPublicKeyHash(cert)
for _, c := range c.PinnedPeerCertificatePublicKeySha256 {
if hmac.Equal(publicHash, c) {
return nil
}
}
}
}
return newError("peer public key is unrecognized.")
}
return nil
}