mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Add binding for libssh2_userauth_publickey_frommemory
This commit is contained in:
@@ -95,10 +95,10 @@ function SSHConnection:password_auth (username, password)
|
||||
end
|
||||
|
||||
---
|
||||
-- Attempts to authenticate using provided private key.
|
||||
-- Attempts to authenticate using provided private key file.
|
||||
--
|
||||
-- @param username A username to authenticate as.
|
||||
-- @param privatekey_file A path to a privatekey.
|
||||
-- @param privatekey_file A path to a privatekey file.
|
||||
-- @param passphrase A passphrase for the privatekey.
|
||||
-- @return true on success or false on failure.
|
||||
function SSHConnection:publickey_auth (username, privatekey_file, passphrase)
|
||||
@@ -113,6 +113,25 @@ function SSHConnection:publickey_auth (username, privatekey_file, passphrase)
|
||||
end
|
||||
end
|
||||
|
||||
---
|
||||
-- Attempts to authenticate using provided private key.
|
||||
--
|
||||
-- @param username A username to authenticate as.
|
||||
-- @param privatekey The privatekey as a string.
|
||||
-- @param passphrase A passphrase for the privatekey.
|
||||
-- @return true on success or false on failure.
|
||||
function SSHConnection:publickey_auth_frommemory (username, privatekey, passphrase)
|
||||
if not self.session then
|
||||
return false
|
||||
end
|
||||
if libssh2.userauth_publickey_frommemory(self.session, username, privatekey, passphrase or "") then
|
||||
self.authenticated = true
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
---
|
||||
-- Closes connection.
|
||||
function SSHConnection:disconnect ()
|
||||
|
||||
Reference in New Issue
Block a user