Gerrit Bot has uploaded this change for review.
crypto/x509: add SignatureAlgorithm.Hash()
Add method to return the hashing algorithm associated with a
certificates signature algorithm. This is useful when generating TLS
channel bindings as documented in RFC 5929.
Fixes #33317
Change-Id: Ib9d9cbca4a33d0e46fad4df1ee02a62d1514b254
GitHub-Last-Rev: 4a4c23d3af176455c648639e37d4b1c49c3df7df
GitHub-Pull-Request: golang/go#33318
---
M src/crypto/x509/x509.go
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go
index 1cd8fde..4798ec8 100644
--- a/src/crypto/x509/x509.go
+++ b/src/crypto/x509/x509.go
@@ -219,6 +219,15 @@
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 (
To view, visit change 187778. To unsubscribe, or for help writing mail filters, visit settings.
Congratulations on opening your first change. Thank you for your contribution!
Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.
Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.
During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.
Gopher Robot abandoned this change.
To view, visit change 187778. To unsubscribe, or for help writing mail filters, visit settings.
Heschi Kreinick restored this change.
To view, visit change 187778. To unsubscribe, or for help writing mail filters, visit settings.