Commit 34920b87 authored by Martins Sipenko's avatar Martins Sipenko Committed by Adam Langley

crypto/x509: add PublicKeyAlgorithm.String()

Change-Id: I77d9c77875519d77bac49cc8870c2e0c4563fe55
Reviewed-on: https://go-review.googlesource.com/44313Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarAdam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
parent b3465646
......@@ -194,7 +194,7 @@ func (algo SignatureAlgorithm) isRSAPSS() bool {
}
}
var algoName = [...]string{
var signatureAlgoName = [...]string{
MD2WithRSA: "MD2-RSA",
MD5WithRSA: "MD5-RSA",
SHA1WithRSA: "SHA1-RSA",
......@@ -213,8 +213,8 @@ var algoName = [...]string{
}
func (algo SignatureAlgorithm) String() string {
if 0 < algo && int(algo) < len(algoName) {
return algoName[algo]
if 0 < algo && int(algo) < len(signatureAlgoName) {
return signatureAlgoName[algo]
}
return strconv.Itoa(int(algo))
}
......@@ -228,6 +228,19 @@ const (
ECDSA
)
var publicKeyAlgoName = [...]string{
RSA: "RSA",
DSA: "DSA",
ECDSA: "ECDSA",
}
func (algo PublicKeyAlgorithm) String() string {
if 0 < algo && int(algo) < len(publicKeyAlgoName) {
return publicKeyAlgoName[algo]
}
return strconv.Itoa(int(algo))
}
// OIDs for signature algorithms
//
// pkcs-1 OBJECT IDENTIFIER ::= {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment