go.crypto/ssh: improve support for MAC algorithms

Also, add support for hmac-sha1.

At the suggestion of AGL hmac-md5, and hmac-md5-96
support was not included.

Fixes golang/go#3095.

R=golang-dev, agl, huin
CC=golang-dev
https://golang.org/cl/5696065
This commit is contained in:
Dave Cheney
2012-02-27 19:40:52 -05:00
committed by Adam Langley
parent 9b05c27191
commit 6de97b525f
6 changed files with 99 additions and 46 deletions
+21
View File
@@ -255,3 +255,24 @@ func TestClientAuthRSAandDSA(t *testing.T) {
}
c.Close()
}
func TestClientHMAC(t *testing.T) {
kc := new(keychain)
kc.keys = append(kc.keys, rsakey)
for _, mac := range DefaultMACOrder {
config := &ClientConfig{
User: "testuser",
Auth: []ClientAuth{
ClientAuthKeyring(kc),
},
Crypto: CryptoConfig{
MACs: []string{mac},
},
}
c, err := Dial("tcp", newMockAuthServer(t), config)
if err != nil {
t.Fatalf("client could not authenticate with mac algo %s: %v", mac, err)
}
c.Close()
}
}