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:
committed by
Adam Langley
parent
9b05c27191
commit
6de97b525f
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user