go.crypto/ssh: Miscellaneous changes up for discussion.

Export key and certificate algorithm names.
Switch from string literals over to using the constants for any key/cert algorithm references.
Make URL references visible in the godoc web display.
Standardize url reference names with surrounding [].

R=dave, agl, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/6944047
This commit is contained in:
Jonathan Pittman
2012-12-14 10:11:06 -05:00
committed by Adam Langley
parent 97c15b3da8
commit 54c65aebf4
6 changed files with 66 additions and 71 deletions
+15 -15
View File
@@ -193,16 +193,16 @@ func serializeSignature(algoname string, sig []byte) []byte {
// The corresponding private key to a public certificate is always a normal
// private key. For signature serialization purposes, ensure we use the
// proper key algorithm name in case the public cert algorithm name is passed.
case certAlgoRSAv01:
algoname = "ssh-rsa"
case certAlgoDSAv01:
algoname = "ssh-dss"
case certAlgoECDSA256v01:
algoname = "ecdsa-sha2-nistp256"
case certAlgoECDSA384v01:
algoname = "ecdsa-sha2-nistp384"
case certAlgoECDSA521v01:
algoname = "ecdsa-sha2-nistp521"
case CertAlgoRSAv01:
algoname = KeyAlgoRSA
case CertAlgoDSAv01:
algoname = KeyAlgoDSA
case CertAlgoECDSA256v01:
algoname = KeyAlgoECDSA256
case CertAlgoECDSA384v01:
algoname = KeyAlgoECDSA384
case CertAlgoECDSA521v01:
algoname = KeyAlgoECDSA521
}
length := stringLength(len(algoname))
length += stringLength(len(sig))
@@ -242,17 +242,17 @@ func serializePublickey(key interface{}) []byte {
func algoName(key interface{}) string {
switch key.(type) {
case *rsa.PublicKey:
return "ssh-rsa"
return KeyAlgoRSA
case *dsa.PublicKey:
return "ssh-dss"
return KeyAlgoDSA
case *ecdsa.PublicKey:
switch key.(*ecdsa.PublicKey).Params().BitSize {
case 256:
return "ecdsa-sha2-nistp256"
return KeyAlgoECDSA256
case 384:
return "ecdsa-sha2-nistp384"
return KeyAlgoECDSA384
case 521:
return "ecdsa-sha2-nistp521"
return KeyAlgoECDSA521
}
case *OpenSSHCertV01:
return algoName(key.(*OpenSSHCertV01).Key) + "-cert-v01@openssh.com"