cert-pin
风扇滑翔翼 2025-09-16 08:32:27 +00:00 committed by GitHub
parent 6bc12448d8
commit 10a185bb65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 26 deletions

View File

@ -407,7 +407,7 @@ type TLSConfig struct {
Fingerprint string `json:"fingerprint"` Fingerprint string `json:"fingerprint"`
RejectUnknownSNI bool `json:"rejectUnknownSni"` RejectUnknownSNI bool `json:"rejectUnknownSni"`
PinnedPeerCertificateChainSha256 *[]string `json:"pinnedPeerCertificateChainSha256"` PinnedPeerCertificateChainSha256 *[]string `json:"pinnedPeerCertificateChainSha256"`
PinnedPeerCertificatePublicKeySha256 *[]string `json:"pinnedPeerCertificatePublicKeySha256"` PinnedPeerCertificateSha256 *[]string `json:"pinnedPeerCertificateSha256"`
CurvePreferences *StringList `json:"curvePreferences"` CurvePreferences *StringList `json:"curvePreferences"`
MasterKeyLog string `json:"masterKeyLog"` MasterKeyLog string `json:"masterKeyLog"`
ServerNameToVerify string `json:"serverNameToVerify"` ServerNameToVerify string `json:"serverNameToVerify"`
@ -469,14 +469,14 @@ func (c *TLSConfig) Build() (proto.Message, error) {
} }
} }
if c.PinnedPeerCertificatePublicKeySha256 != nil { if c.PinnedPeerCertificateSha256 != nil {
config.PinnedPeerCertificatePublicKeySha256 = [][]byte{} config.PinnedPeerCertificateSha256 = [][]byte{}
for _, v := range *c.PinnedPeerCertificatePublicKeySha256 { for _, v := range *c.PinnedPeerCertificateSha256 {
hashValue, err := base64.StdEncoding.DecodeString(v) hashValue, err := hex.DecodeString(v)
if err != nil { if err != nil {
return nil, err return nil, err
} }
config.PinnedPeerCertificatePublicKeySha256 = append(config.PinnedPeerCertificatePublicKeySha256, hashValue) config.PinnedPeerCertificateSha256 = append(config.PinnedPeerCertificateSha256, hashValue)
} }
} }