mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-13 11:59:35 +03:00
Support SPKI Fingerprint Pinning
Support SPKI Fingerprint Pinning for TLSObject
This commit is contained in:
@ -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[:]
|
||||
}
|
||||
|
Reference in New Issue
Block a user