MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / Error

Method Error

tests/textcode/data/analysis/verify.go:104–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102}
103
104func (h HostnameError) Error() string {
105 c := h.Certificate
106
107 var valid string
108 if ip := net.ParseIP(h.Host); ip != nil {
109 // Trying to validate an IP
110 if len(c.IPAddresses) == 0 {
111 return "x509: cannot validate certificate for " + h.Host + " because it doesn't contain any IP SANs"
112 }
113 for _, san := range c.IPAddresses {
114 if len(valid) > 0 {
115 valid += ", "
116 }
117 valid += san.String()
118 }
119 } else {
120 if c.hasSANExtension() {
121 valid = strings.Join(c.DNSNames, ", ")
122 } else {
123 valid = c.Subject.CommonName
124 }
125 }
126
127 if len(valid) == 0 {
128 return "x509: certificate is not valid for any names, but wanted to match " + h.Host
129 }
130 return "x509: certificate is valid for " + valid + ", not " + h.Host
131}
132
133// UnknownAuthorityError results when the certificate issuer is unknown
134type UnknownAuthorityError struct {

Callers 3

copytreeFunction · 0.45
ErrorMethod · 0.45
checkNameConstraintsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected