diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go index 1cd8fdeb331e4d..4798ec8607a1d8 100644 --- a/src/crypto/x509/x509.go +++ b/src/crypto/x509/x509.go @@ -219,6 +219,15 @@ func (algo SignatureAlgorithm) String() string { return strconv.Itoa(int(algo)) } +func (algo SignatureAlgorithm) Hash() crypto.Hash { + for _, details := range signatureAlgorithmDetails { + if details.algo == algo { + return details.hash + } + } + return crypto.Hash(0) +} + type PublicKeyAlgorithm int const (