mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-27 12:24:14 +00:00
Commands: Output certificate chain's total length in tls ping
(#4933)
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
parent
9d15ecf1f9
commit
87d8b97d9a
1 changed files with 11 additions and 5 deletions
|
@ -122,13 +122,19 @@ func executePing(cmd *base.Command, args []string) {
|
|||
}
|
||||
|
||||
func printCertificates(certs []*x509.Certificate) {
|
||||
var leaf *x509.Certificate
|
||||
var length int
|
||||
for _, cert := range certs {
|
||||
if len(cert.DNSNames) == 0 {
|
||||
continue
|
||||
length += len(cert.Raw)
|
||||
if len(cert.DNSNames) != 0 {
|
||||
leaf = cert
|
||||
}
|
||||
fmt.Println("Cert's signature algorithm: ", cert.SignatureAlgorithm.String())
|
||||
fmt.Println("Cert's publicKey algorithm: ", cert.PublicKeyAlgorithm.String())
|
||||
fmt.Println("Cert's allowed domains: ", cert.DNSNames)
|
||||
}
|
||||
fmt.Println("Certificate chain's total length: ", length, "(certs count: "+strconv.Itoa(len(certs))+")")
|
||||
if leaf != nil {
|
||||
fmt.Println("Cert's signature algorithm: ", leaf.SignatureAlgorithm.String())
|
||||
fmt.Println("Cert's publicKey algorithm: ", leaf.PublicKeyAlgorithm.String())
|
||||
fmt.Println("Cert's allowed domains: ", leaf.DNSNames)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue