Commands: Print leaf cert's SHA256 in tls ping (#5628)

And https://github.com/XTLS/Xray-core/pull/5628#issuecomment-3828445442

---------

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
风扇滑翔翼
2026-01-31 21:11:36 +08:00
committed by GitHub
parent 2c92339f95
commit afcfdbca70
2 changed files with 6 additions and 19 deletions
+5 -1
View File
@@ -639,10 +639,14 @@ func (c *TLSConfig) Build() (proto.Message, error) {
if v == "" {
continue
}
hashValue, err := hex.DecodeString(v)
// remove colons for OpenSSL format
hashValue, err := hex.DecodeString(strings.ReplaceAll(v, ":", ""))
if err != nil {
return nil, err
}
if len(hashValue) != 32 {
return nil, errors.New("incorrect pinnedPeerCertSha256 length: ", v)
}
config.PinnedPeerCertSha256 = append(config.PinnedPeerCertSha256, hashValue)
}
}