return "publickey"
}
-// ClientAuthPublickey returns a ClientAuth using public key authentication.
-func ClientAuthPublickey(impl ClientKeyring) ClientAuth {
+// ClientAuthKeyring returns a ClientAuth using public key authentication.
+func ClientAuthKeyring(impl ClientKeyring) ClientAuth {
return &publickeyAuth{impl}
}
PasswordCallback: func(user, pass string) bool {
return user == "testuser" && pass == string(clientPassword)
},
- PubKeyCallback: func(user, algo string, pubkey []byte) bool {
+ PublicKeyCallback: func(user, algo string, pubkey []byte) bool {
key := clientKeychain.keys[0].(*rsa.PrivateKey).PublicKey
expected := []byte(serializePublickey(key))
algoname := algoName(key)
config := &ClientConfig{
User: "testuser",
Auth: []ClientAuth{
- ClientAuthPublickey(clientKeychain),
+ ClientAuthKeyring(clientKeychain),
},
}
c, err := Dial("tcp", newMockAuthServer(t), config)
User: "testuser",
Auth: []ClientAuth{
ClientAuthPassword(wrongPw),
- ClientAuthPublickey(clientKeychain),
+ ClientAuthKeyring(clientKeychain),
},
}
config := &ClientConfig{
User: "testuser",
Auth: []ClientAuth{
- ClientAuthPublickey(kc),
+ ClientAuthKeyring(kc),
},
}
config := &ClientConfig{
User: "testuser",
Auth: []ClientAuth{
- ClientAuthPublickey(kc),
+ ClientAuthKeyring(kc),
},
}
c, err := Dial("tcp", newMockAuthServer(t), config)
config := &ClientConfig{
User: *sshuser,
Auth: []ClientAuth{
- ClientAuthPublickey(kc),
+ ClientAuthKeyring(kc),
},
}
conn, err := Dial("tcp", "localhost:22", config)
// several goroutines.
PasswordCallback func(user, password string) bool
- // PubKeyCallback, if non-nil, is called when a client attempts public
+ // PublicKeyCallback, if non-nil, is called when a client attempts public
// key authentication. It must return true iff the given public key is
// valid for the given user.
- PubKeyCallback func(user, algo string, pubkey []byte) bool
+ PublicKeyCallback func(user, algo string, pubkey []byte) bool
// Cryptographic-related configuration.
Crypto CryptoConfig
// testPubKey returns true if the given public key is acceptable for the user.
func (s *ServerConn) testPubKey(user, algo string, pubKey []byte) bool {
- if s.config.PubKeyCallback == nil || !isAcceptableAlgo(algo) {
+ if s.config.PublicKeyCallback == nil || !isAcceptableAlgo(algo) {
return false
}
}
}
- result := s.config.PubKeyCallback(user, algo, pubKey)
+ result := s.config.PublicKeyCallback(user, algo, pubKey)
if len(s.cachedPubKeys) < maxCachedPubKeys {
c := cachedPubKey{
user: user,
break userAuthLoop
}
case "publickey":
- if s.config.PubKeyCallback == nil {
+ if s.config.PublicKeyCallback == nil {
break
}
payload := userAuthReq.Payload
if s.config.PasswordCallback != nil {
failureMsg.Methods = append(failureMsg.Methods, "password")
}
- if s.config.PubKeyCallback != nil {
+ if s.config.PublicKeyCallback != nil {
failureMsg.Methods = append(failureMsg.Methods, "publickey")
}
serverConfig.PasswordCallback = func(user, pass string) bool {
return user == "testuser" && pass == string(pw)
}
- serverConfig.PubKeyCallback = nil
+ serverConfig.PublicKeyCallback = nil
l, err := Listen("tcp", "127.0.0.1:0", serverConfig)
if err != nil {