| Home · Modules · Classes · Namespaces · Functions |
The QxtSshClient class implements a Secure Shell client More...
#include <QxtSshClient>
Inherits QObject.
The QxtSshClient class implements a Secure Shell client
QxtSshClient allows connecting to any standard SSH server.
It provides facilities for password authentication or public key authentication, and provides methods to open a shell or a TCP socket on the remote host.
The passphrase can be set before connecting or it can be provided in response to the authenticationRequired() signal. This allows the password to be stored in advance or prompted for only when needed.
QxtSshClient is based on the third-party library libssh2 (http://www.libssh2.org/) provided under the following license:
* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
* Copyright (c) 2005,2006 Mikhail Gusarov <dottedmag@dottedmag.net>
* Copyright (c) 2006-2007 The Written Word, Inc.
* Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
* Copyright (c) 2009 Daniel Stenberg
* Copyright (C) 2008, 2009 Simon Josefsson
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the copyright holder nor the names
* of any other contributors may be used to endorse or
* promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
| Constant | Value | Description |
|---|---|---|
| QxtSshClient::PasswordAuthentication | 0 | Authenticate using a password |
| QxtSshClient::PublicKeyAuthentication | 1 | Authenticate using a public key |
| Constant | Value | Description |
|---|---|---|
| QxtSshClient::AuthenticationError | 0 | An error occurred while authenticating. |
| QxtSshClient::HostKeyUnknownError | 1 | The host key is unknown. |
| QxtSshClient::HostKeyInvalidError | 2 | The host key is invalid. |
| QxtSshClient::HostKeyMismatchError | 3 | The host key does not match the key recorded in the known hosts. |
| QxtSshClient::ConnectionRefusedError | 4 | The connection was refused. |
| QxtSshClient::UnexpectedShutdownError | 5 | The connection was unexpectedly shut down. |
| QxtSshClient::HostNotFoundError | 6 | The host could not be found. |
| QxtSshClient::SocketError | 7 | An error occurred on the underlying socket. |
| QxtSshClient::UnknownError | 8 | An unknown error occurred. |
| Constant | Value | Description |
|---|---|---|
| QxtSshClient::OpenSslFormat | 0 | Use the .ssh/known_hosts file format. |
Constructs a new QxtSshClient with the specified parent.
Destroys the QxtSshClient object.
Adds a host key to the list of known host signatures.
This list is used for host key verification during connection.
See also loadKnownHosts and saveKnownHosts.
Attempts to make a connection to host on the given port as the specified user.
QxtSshClient will attempt to authenticate first using the public key, if provided, then using the password, if provided. If neither of these methods succeed in authenticating, the authenticationRequired() signal will be emitted. The public key and/or password can be changed in a slot directly connected to this signal. After the signal has resolved, the public key and password will be tried again.
The connected() signal will be emitted when the connection is complete. At any point, QxtSshClient can emit error() to signal that an error occurred.
The host parameter can be an IP address or a host name. Host names will be resolved by the server.
This signal is emitted when a connection to the SSH server has been successfully established.
Disconnects the current SSH connection.
Any open channels will be closed. When the connection has been closed, the disconnected() signal will be emitted.
This signal is emitted when the connection to the SSH server has been closed.
This signal is emitted after an error occurs. The error parameter describes the type of error that occurred.
Returns the host key of the currently connected server.
Returns the hostname of the currently connected server.
Loads a list of known host signatures from a file.
This list is used for host key verification during connection.
Opens a new SSH channel that can invoke a process or SSH subsystem on the SSH server. The process's stdin, stdout, and stderr are piped through the channel.
Returns NULL if an error occurs while opening the channel, such as not being connected to an SSH server.
See also QxtSshProcess.
Opens a new SSH channel and attempts to establish a TCP connection from the SSH server to a remote host. Traffic on this TCP connection is tunneled through the channel.
Note that traffic between the SSH server and the remote host is unencrypted. Only communication between QxtSshClient and the SSH server is encrypted.
Returns NULL if an error occurs while opening the channel, such as not being connected to an SSH server.
See also QxtSshTcpSocket.
Saves the current list of known host signatures to a file.
See also loadKnownHosts.
Sets a public and private key pair to use to authenticate to the SSH server.
If the private key is secured with a passphrase, the passphrase set with setPassphrase() will be used.
Sets the password for the user. This password is also used for the passphrase of the private key.
| Copyright © 2007-2010 Qxt Foundation |
Qxt 0.7.0 |