1
0
mirror of https://github.com/golang/go synced 2024-11-19 14:34:42 -07:00

crypto/x509: add PublicKeyAlgorithm.String()

Change-Id: I77d9c77875519d77bac49cc8870c2e0c4563fe55
Reviewed-on: https://go-review.googlesource.com/44313
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
This commit is contained in:
Martins Sipenko 2017-05-26 14:35:29 +03:00 committed by Adam Langley
parent b3465646ff
commit 34920b8713

View File

@ -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 ::= {