SSHClient class

The Secure Shell (SSH) is a protocol for secure remote login and other secure network services over an insecure network.

Inheritance
Mixed-in types

Constructors

SSHClient({Uri hostport, String login, String termvar = '', int termWidth = 80, int termHeight = 25, String startupCommand, bool compress = false, bool agentForwarding = false, bool closeOnDisconnect, bool startShell = true, List<Forward> forwardLocal, List<Forward> forwardRemote, VoidCallback disconnected, ResponseCallback response, StringCallback print, StringCallback debugPrint, StringCallback tracePrint, VoidCallback success, FingerprintCallback acceptHostFingerprint, IdentityFunction loadIdentity, Uint8ListFunction getPassword, SocketInterface socketInput, Random random, SecureRandom secureRandom})

Properties

acceptedHostkey bool
getter/setter pair
acceptHostFingerprint FingerprintCallback
getter/setter pair
agentForwarding bool
getter/setter pair
channels HashMap<int, Channel>
getter/setter pairinherited
cipherIdC2s int
getter/setter pairinherited
cipherIdS2c int
getter/setter pairinherited
client bool
Whether we've initiated the connection.
no setterinherited
closeOnDisconnect bool
getter/setter pair
compress bool
Whether compression is supported.
getter/setter pairinherited
compressIdC2s int
getter/setter pairinherited
compressIdS2c int
getter/setter pairinherited
debugPrint StringCallback
Parameter invoked with debug logging.
getter/setter pairinherited
decrypt ↔ BlockCipher
getter/setter pairinherited
decryptBlockSize int
getter/setter pairinherited
decryptBuf Uint8List
getter/setter pairinherited
dh DiffieHellman
getter/setter pairinherited
disconnected VoidCallback
Parameter invoked on connection close.
getter/setter pairinherited
ecdh EllipticCurveDiffieHellman
getter/setter pairinherited
encrypt ↔ BlockCipher
getter/setter pairinherited
encryptBlockSize int
getter/setter pairinherited
exH Uint8List
getter/setter pairinherited
forwardingRemote HashMap<int, Forward>
getter/setter pairinherited
forwardLocal List<Forward>
Parameter describing local ports to forward over SSH tunnel.
getter/setter pairinherited
forwardRemote List<Forward>
Parameter describing remote ports to forward over SSH tunnel.
getter/setter pairinherited
getPassword Uint8ListFunction
getter/setter pair
guessedC bool
getter/setter pairinherited
guessedRightC bool
getter/setter pairinherited
guessedRightS bool
getter/setter pairinherited
guessedS bool
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
hostkeyType int
getter/setter pairinherited
hostport Uri
Remote endpoint of SSH connection. Parameter on client-side.
getter/setter pairinherited
identity Identity
Parameter for public key authentication
getter/setter pairinherited
initialWindowSize int
getter/setter pairinherited
integrityC2s Uint8List
getter/setter pairinherited
integrityS2c Uint8List
getter/setter pairinherited
K BigInt
getter/setter pairinherited
kexHash ↔ Digest
getter/setter pairinherited
kexInitC Uint8List
getter/setter pairinherited
kexInitS Uint8List
getter/setter pairinherited
kexMethod int
getter/setter pairinherited
loadedPw bool
getter/setter pair
loadIdentity IdentityFunction
getter/setter pair
login String
getter/setter pair
loginPrompts int
getter/setter pair
macAlgoC2s ↔ HMac
getter/setter pairinherited
macAlgoS2c ↔ HMac
getter/setter pairinherited
macHashLenC int
getter/setter pairinherited
macHashLenS int
getter/setter pairinherited
macIdC2s int
getter/setter pairinherited
macIdS2c int
getter/setter pairinherited
macPrefixC2s int
getter/setter pairinherited
macPrefixS2c int
getter/setter pairinherited
maxPacketSize int
getter/setter pairinherited
nextChannelId int
getter/setter pairinherited
packetId int
getter/setter pairinherited
packetLen int
getter/setter pairinherited
packetMacLen int
getter/setter pairinherited
packetS SerializableInput
getter/setter pairinherited
padding int
getter/setter pairinherited
passwordPrompts int
getter/setter pair
print StringCallback
Parameter invoked with ERROR and INFO loggging.
getter/setter pairinherited
pw Uint8List
getter/setter pair
random Random
Source of randomness, e.g Random.secure().
getter/setter pairinherited
readBuffer QueueBuffer
getter/setter pairinherited
remoteForward RemoteForwardCallback
Paramter invoked upon connection to forwarded remote port.
getter/setter pairinherited
response ResponseCallback
Parameter invoked with session channel data (and optionally UI prompts).
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secureRandom ↔ SecureRandom
Pointycastle's random interface.
getter/setter pairinherited
sequenceNumberC2s int
getter/setter pairinherited
sequenceNumberS2c int
getter/setter pairinherited
server bool
getter/setter pairinherited
serverVersion num
getter/setter pairinherited
sessionChannel Channel
getter/setter pairinherited
sessionId Uint8List
getter/setter pairinherited
socket SocketInterface
getter/setter pairinherited
startShell bool
getter/setter pair
startupCommand String
getter/setter pair
state int
getter/setter pairinherited
success List<VoidCallback>
getter/setter pair
termHeight int
getter/setter pair
termvar String
getter/setter pair
termWidth int
getter/setter pair
tracePrint StringCallback
Parameter invoked with trace logging.
getter/setter pairinherited
userauthFail int
getter/setter pair
verC String
getter/setter pairinherited
verS String
getter/setter pairinherited
wrotePw bool
getter/setter pair
x25519dh X25519DiffieHellman
getter/setter pairinherited
zreader ↔ dynamic
getter/setter pairinherited
zwriter ↔ dynamic
getter/setter pairinherited

Methods

acceptChannel(MSG_CHANNEL_OPEN msg) Channel
Accepts MSG_CHANNEL_OPEN request to open a new Channel.
inherited
clearPassword() → void
"Securely" clears the local password storage.
closeChannel(Channel channel) → void
Send EOF and close for channel.
inherited
computeExchangeHashAndVerifyHostKey(Uint8List kS, Uint8List hSig) bool
Updates exH and verifies kS's hSig. On success MSG_NEWKEYS is sent.
disconnect(String reason) → void
If anything goes wrong, disconnect with reason.
inherited
exec(String command, {bool wantReply = true}) → void
getSecureRandom() → SecureRandom
PointyCastle random number generator interface.
inherited
getThenSendPassword() → void
Calls sendPassword() if getPassword succeeds.
handleAGENTC_REQUEST_IDENTITIES(Channel channel) → void
Responds with any identities we're forwarding.
inherited
handleAGENTC_SIGN_REQUEST(Channel channel, AGENTC_SIGN_REQUEST msg) → void
Signs challenge authenticating a descendent channel.
inherited
handleAgentPacket(Channel channel, SerializableInput agentPacketS) → void
inherited
handleAgentRead(Channel channel, Uint8List msg) → void
Frames SSH Agent channel data into packets.
inherited
handleChannelClose(Channel chan, [String description]) → void
Handles Channel closed by server.
override
handleChannelData(Channel chan, Uint8List data) → void
Handles all Channel data for this session.
override
handleChannelOpenConfirmation(Channel channel) → void
Handles successfully opened client-initiated Channel.
override
handleConnected() → void
When the connection has been established, both sides MUST send an identification string. https://tools.ietf.org/html/rfc4253#section-4.2
inherited
handleDhGroupMSG_KEX_DH_GEX_GROUP(MSG_KEX_DH_GEX_GROUP msg) → void
Completes Diffie-Hellman Group Exchange and begins key exchange.
handleDhMSG_KEXDH_REPLY(MSG_KEXDH_REPLY msg) Uint8List
Completes Diffie-Hellman key exchange.
handleEcDhMSG_KEX_ECDH_REPLY(MSG_KEX_ECDH_REPLY msg) Uint8List
Completes Elliptic-curve Diffie–Hellman key exchange.
handleInitialState() → void
Consumes the initial Protocol Version Exchange. https://tools.ietf.org/html/rfc4253#section-4.2
inherited
handleMSG_CHANNEL_CLOSE(MSG_CHANNEL_CLOSE msg) → void
Upon receiving this message, a party MUST send back an SSH_MSG_CHANNEL_CLOSE unless it has already sent this message for the channel.
inherited
handleMSG_CHANNEL_DATA(MSG_CHANNEL_DATA msg) → void
Data transfer is done with messages of the type SSH_MSG_CHANNEL_DATA.
inherited
handleMSG_CHANNEL_EOF(MSG_CHANNEL_EOF msg) → void
No explicit response is sent to this message. However, the application may send EOF to whatever is at the other end of the channel.
inherited
handleMSG_CHANNEL_OPEN(MSG_CHANNEL_OPEN msg, SerializableInput packetS) → void
Handles server-initiated Channel to client. e.g. for remote port forwarding, or SSH agent request.
handleMSG_CHANNEL_OPEN_CONFIRMATION(MSG_CHANNEL_OPEN_CONFIRMATION msg) → void
If the remote side can open the channel, it responds with SSH_MSG_CHANNEL_OPEN_CONFIRMATION.
inherited
handleMSG_CHANNEL_OPEN_FAILURE(MSG_CHANNEL_OPEN_FAILURE msg) → void
If the remote side can't open the channel, it responds with SSH_MSG_CHANNEL_OPEN_FAILURE.
inherited
handleMSG_CHANNEL_REQUEST(MSG_CHANNEL_REQUEST msg) → void
Logs any (unhandled) channel specific requests from server.
handleMSG_CHANNEL_WINDOW_ADJUST(MSG_CHANNEL_WINDOW_ADJUST msg) → void
After receiving this message, the recipient MAY send the given number of bytes more than it was previously allowed to send; the window size is incremented.
inherited
handleMSG_DEBUG(MSG_DEBUG msg) → void
All implementations MUST understand MSG_DEBUG, but they are allowed to ignore it.
inherited
handleMSG_DISCONNECT(MSG_DISCONNECT msg) → void
The recipient MUST NOT accept any data after receiving MSG_DISCONNECT.
inherited
handleMSG_GLOBAL_REQUEST(MSG_GLOBAL_REQUEST msg) → void
https://tools.ietf.org/html/rfc4254#section-4
inherited
handleMSG_IGNORE(MSG_IGNORE msg) → void
MSG_IGNORE can be used as an additional protection measure against advanced traffic analysis techniques.
inherited
handleMSG_KEXDH_REPLY(int packetId, Uint8List packet) → void
https://tools.ietf.org/html/rfc4253#section-8
handleMSG_KEXINIT(MSG_KEXINIT msg, Uint8List packet) → void
https://tools.ietf.org/html/rfc4253#section-7.1
inherited
handleMSG_NEWKEYS() → void
When MSG_NEWKEYS is received, the new keys and algorithms MUST be used for receiving.
inherited
handleMSG_SERVICE_ACCEPT() → void
Handle accepted MSG_SERVICE_REQUEST sent in response to MSG_NEWKEYS.
handleMSG_USERAUTH_FAILURE(MSG_USERAUTH_FAILURE msg) → void
If key authentication failed, then try password authentication.
handleMSG_USERAUTH_INFO_REQUEST(MSG_USERAUTH_INFO_REQUEST msg) → void
The server can optionally request authentication information from the client.
handleMSG_USERAUTH_SUCCESS() → void
After successfull authentication, open the session channel and start compression.
handlePacket(Uint8List packet) → void
https://tools.ietf.org/html/rfc4253#section-6
override
handleRead(Uint8List dataChunk) → void
Callback supplied to socket.listen.
inherited
handleSessionStarted() → void
After the session is established, initialize channel state.
handleX25519MSG_KEX_ECDH_REPLY(MSG_KEX_ECDH_REPLY msg) Uint8List
Completes X25519 key exchange.
initCipher(int cipherId, Uint8List IV, Uint8List key, bool dir) → BlockCipher
Initializes the block cipher used for encrypted transport.
inherited
initializeDiffieHellman(int kexMethod, Random random) → void
inherited
initializeDiffieHellmanGroup(BigInt p, BigInt g, Random random) → void
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onConnected() → void
Callback supplied to socket.connect.
inherited
openTcpChannel(String sourceHost, int sourcePort, String destHost, int destPort, ChannelCallback cb, {VoidCallback connected, StringCallback error}) Channel
Request remote opens a new TCP channel to destHost:destPort.
inherited
readCipher(Uint8List m) Uint8List
Decrypt data using the negotiated block cipher.
inherited
sendAuthenticationRequest() → void
Sends MSG_USERAUTH_REQUEST optionally using identity or keyboard-interactive.
sendChannelData(Uint8List b) → void
Sends channel data b on sessionChannel. Optionally b is captured by loginPrompts or passwordPrompts.
override
sendDiffileHellmanInit() → void
Initialize a shared-secret negotiation culminating with MSG_NEWKEYS.
override
sendKeyExchangeInit(bool guess) → void
Key exchange begins by each side sending SSH_MSG_KEXINIT.
inherited
sendNewKeys() → void
inherited
sendPassword() → void
Sends MSG_USERAUTH_REQUEST with password pw.
sendToChannel(Channel channel, Uint8List data) → void
Sends data to channel.
inherited
setTerminalWindowSize(int w, int h) → void
Sends window-change MSG_CHANNEL_REQUEST.
toString() String
A string representation of this object.
inherited
updateExchangeHash(Uint8List kS) → void
Computes a new exchange hash exH given the server key kS.
inherited
writeCipher(SSHMessage msg) → void
Encrypt Binary Packet data using the negotiated block cipher and MAC.
inherited
writeClearOrEncrypted(SSHMessage msg) → void
Send a Binary Packet (e.g. KEX_INIT) that is initially sent in the clear, but encryped when keys are being renegotiated.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited