diff --git a/lib/net/ssh/authentication/methods/publickey.rb b/lib/net/ssh/authentication/methods/publickey.rb
index <HASH>..<HASH> 100644
--- a/lib/net/ssh/authentication/methods/publickey.rb
+++ b/lib/net/ssh/authentication/methods/publickey.rb
@@ -82,6 +82,8 @@ module Net
 
             when USERAUTH_FAILURE
               return false
+            when USERAUTH_SUCCESS
+              return true
 
             else
               raise Net::SSH::Exception, "unexpected reply to USERAUTH_REQUEST: #{message.type} (#{message.inspect})"
fixing to work with windows and wingftpserver connecting with public key