SSHClient Module
Properties Methods Events Config Settings Errors
The SSHClient module provides client-side SSH protocol functionality.
Syntax
SecureBlackbox.Sshclient
Remarks
Use SSHClient to establish terminal-like connections to remote systems and run commands remotely. The component supports most of third-party implementations out there, and is capable of working in "shell" and "command" modes.
Start with assigning your sign-in credentials to Username and Password properties. Where public key authentication is to be used, assign your private authentication key to Key property (remember to set Username in this case too). Subscribe to events to be notified of the session progress. AuthFailed, AuthSucceeded, and Connect are among those particularly useful.
Special attention should be paid to setting up the server key trust. Class only allows connections to servers whose public keys are recognized as trusted, much like any other SSH clients do. Assign a path to the file containing the list of trusted keys to TrustedKeysFile property. If you don't have such file, or if you would like to make trust decisions on the fly, subscribe to KnownKeyReceived and UnknownKeyReceived events. These are fired whenever a trusted or untrusted key is received from the server. For unknown/untrusted keys, you need to set the Action parameter in your UnknownKeyReceived event handler to catAcceptOnce (1) or catAcceptPermanently (2) for the connection to proceed.
Once you are all set up, you can go ahead by calling the Connect method. This launches the SSH handshake and, if everything has been set up right, establishes a connection to the server. You can now use Send and Receive methods to exchange information with the server. You can exchange data in synchronous or asynchronous way; see the description in AsyncMode topic to learn more about each mode.
When you are done with the session, call Disconnect to shut the connection down.
Hint: If you are only interested in a quick-and-dirty execution of a simple, non-interactive command, SSHClient offers a handy shortcut. ConnectAndExec method is a self-contained mechanism which sets up a connection, performs the data exchange internally, and returns the command output. Please keep in mind that you still need to set up the server trust settings as described above for this method to work.
Property List
The following is the full list of the properties of the module with short descriptions. Click on the links for further details.
AsyncMode | Controls the SSH clients mode of work. |
AuthAttempts | Specifies the number of SSH password authentication attempts. |
Commands | Specifies the list of commands to execute. |
Connected | Specifies whether the client is connected to the SFTP server. |
ConnectionInfo | Contains the secure connection info. |
ExitMessage | Contains the last commands exit message. |
ExitSignal | Contains the last commands exit signal. |
ExitStatus | Contains the last commands exit status. |
ExternalCrypto | Provides access to external signing and DC parameters. |
FIPSMode | Reserved. |
Key | Contains client's SSH key. |
Password | Specifies user's password on the server. |
Proxy | Allows connection through a proxy server. |
ServerKey | Returns server's public key. |
SocketSettings | Manages network connection settings. |
SSHSettings | Provides access to SSH connection settings. |
Subsystem | Specifies the subsystem to request from the server. |
Terminal | Provides access to SSH terminal settings object. |
TrustedKeysFile | Path to the file containing public keys of authorized servers. |
Username | Specifies client's username on the server. |
Method List
The following is the full list of the methods of the module with short descriptions. Click on the links for further details.
Config | Sets or retrieves a configuration setting. |
Connect | Establishes connection to an SSH server. |
ConnectAndExec | Connects to an SSH server and executes a command in one go. |
Disconnect | Closes connection to the SSH server. |
DoAction | Performs an additional action. |
Ping | Sends a keep-alive request to the SSH server. |
Poll | Checks whether there is any inbound data readily available. |
Receive | Reads a portion of received data into a string. |
ReceiveBytes | Reads a portion of received data into a byte array. |
ReceiveBytesFrom | Reads a portion of data received via a specific channel into a byte array. |
ReceiveFrom | Reads a portion of data received via a specific channel into a string. |
Send | Sends a string to the server. |
SendBytes | Sends an array of bytes to the server. |
SendSpecial | Sends a special character to the server or remote command. |
Event List
The following is the full list of the events fired by the module with short descriptions. Click on the links for further details.
AuthAttempt | Fires when a single authentication attempt is performed. |
AuthFailed | Fires when a single authentication attempt is failed. |
AuthSucceeded | Reports a successful authentication. |
Banner | Reports the receipt of the Hello message from the server. |
CommandCompleted | Signifies completion of the command execution. |
CommandStart | Marks the commencement of a command execution. |
Connect | This event is fired when an SSH session has been established. |
DataReceived | Reports receipt of another chunk of data from the server. |
DataSent | Notifies the application that a piece of data has been sent to the server. |
Disconnect | This event is fired when the SFTP subsystem connection is closed. |
Error | Information about errors during SFTP connection. |
ExternalSign | Handles remote or external signing initiated by the SignExternal method or other source. |
KnownKeyReceived | Signals that the server has introduced itself with a known key. |
Notification | This event notifies the application about an underlying control flow event. |
PasswordChangeRequest | This event is fired when a password change is requested. |
PrivateKeyNeeded | This event is fired when client's public key was accepted by the server, but the corresponding secret key is not available. |
UnknownKeyReceived | Signals that the server has introduced itself with an unknown key. |
Config Settings
The following is a list of config settings for the module with short descriptions. Click on the links for further details.
BlockSize | The data block size. |
ErrorOrigin | Specifies whether the error is local or remote. |
ErrorSeverity | Specifies whether the error is fatal. |
LocalCharset | Charset used on the client machine. |
RemoteCharset | Charset used on the server. |
SendCommandEOF | Defines whether EOF control character should be sent after the command data. |
ThrottleControl | Enables or disables throttle control for the connection. |
CheckKeyIntegrityBeforeUse | Enables or disable private key integrity check before use. |
CookieCaching | Specifies whether a cookie cache should be used for HTTP(S) transports. |
Cookies | Gets or sets local cookies for the module (supported for HTTPClient, RESTClient and SOAPClient only). |
DefDeriveKeyIterations | Specifies the default key derivation algorithm iteration count. |
EnableClientSideSSLFFDHE | Enables or disables finite field DHE key exchange support in TLS clients. |
GlobalCookies | Gets or sets global cookies for all the HTTP transports. |
HttpUserAgent | Specifies the user agent name to be used by all HTTP clients. |
LogDestination | Specifies the debug log destination. |
LogDetails | Specifies the debug log details to dump. |
LogFile | Specifies the debug log filename. |
LogFilters | Specifies the debug log filters. |
LogFlushMode | Specifies the log flush mode. |
LogLevel | Specifies the debug log level. |
LogMaxEventCount | Specifies the maximum number of events to cache before further action is taken. |
LogRotationMode | Specifies the log rotation mode. |
MaxASN1BufferLength | Specifies the maximal allowed length for ASN.1 primitive tag data. |
MaxASN1TreeDepth | Specifies the maximal depth for processed ASN.1 trees. |
OCSPHashAlgorithm | Specifies the hash algorithm to be used to identify certificates in OCSP requests. |
StaticDNS | Specifies whether static DNS rules should be used. |
StaticIPAddress[domain] | Gets or sets an IP address for the specified domain name. |
StaticIPAddresses | Gets or sets all the static DNS rules. |
Tag | Allows to store any custom data. |
UseOwnDNSResolver | Specifies whether the client modules should use own DNS resolver. |
UseSharedSystemStorages | Specifies whether the validation engine should use a global per-process copy of the system certificate stores. |
UseSystemOAEPAndPSS | Enforces or disables the use of system-driven RSA OAEP and PSS computations. |
UseSystemRandom | Enables or disables the use of the OS PRNG. |
AsyncMode Property (SSHClient Module)
Controls the SSH clients mode of work.
Syntax
public var asyncMode: Bool { get {...} set {...} }
@property (nonatomic,readwrite,assign,getter=asyncMode,setter=setAsyncMode:) BOOL asyncMode; - (BOOL)asyncMode; - (void)setAsyncMode :(BOOL)newAsyncMode;
Default Value
False
Remarks
This property defines the way in which the class communicates with the application/user code. AsyncMode set to false makes the component use synchronous single-thread approach. Synchronous mode is generally simpler to integrate and use, but please keep in mind that the calls like Connect, Receive or SendBytes may block until their execution completes. In asyncronous mode all operations return immediately, but more care should be taken about handling them in your code properly.
Here are a few highlights of each mode.
Synchronous mode:
- All operations are performed within the caller thread context
- Operations like Connect or SendBytes may block
- Use Poll to check for the availability of data before reading it out with Receive or ReceiveBytes
- Return of a call guarantees completion of the operation
- Connection errors are reported straight from the methods via exceptions
Asynchronous mode:
- All operations are performed in a separate thread (and so are the event calls!)
- Methods like Send return immediately
- Use DataSent and DataReceived events to be notified about actual data transmissions
- Return of call only marks the beginning of the operation and does not guarantee its successful completion
- Connection errors are reported via Error event, often followed by Disconnect.
Please note that this is a very important and sensitive property, which has a wide-scale effect on the way the SSH client works and co-operates with the application. Depending on the value assigned to this setting you may need to work with the component very differently.
When setting this property to true, please make sure that your code is prepared to handle events coming from the context of a different thread.
AuthAttempts Property (SSHClient Module)
Specifies the number of SSH password authentication attempts.
Syntax
public var authAttempts: Int32 { get {...} set {...} }
@property (nonatomic,readwrite,assign,getter=authAttempts,setter=setAuthAttempts:) int authAttempts; - (int)authAttempts; - (void)setAuthAttempts :(int)newAuthAttempts;
Default Value
1
Remarks
In case of password authentication failure provide new password inside the AuthFailed event handler.
Commands Property (SSHClient Module)
Specifies the list of commands to execute.
Syntax
public var commands: String { get {...} set {...} }
@property (nonatomic,readwrite,assign,getter=commands,setter=setCommands:) NSString* commands; - (NSString*)commands; - (void)setCommands :(NSString*)newCommands;
Default Value
""
Remarks
Use this property to provide a list of commands to execute remotely. Separate different commands with EOL characters.
When this property is set, the component works in the command mode, meaning each command is executed in its own virtual terminal session. No shell connection is established.
If no commands are provided via this property, the component will establish a shell session.
Connected Property (SSHClient Module)
Specifies whether the client is connected to the SFTP server.
Syntax
public var connected: Bool { get {...} }
@property (nonatomic,readonly,assign,getter=connected) BOOL connected; - (BOOL)connected;
Default Value
False
Remarks
Use this read-only property to check whether the client is connected to the server.
This property is read-only.
ConnectionInfo Property (SSHClient Module)
Contains the secure connection info.
Syntax
public var connectionInfo: SSHInfo { get {...} }
@property (nonatomic,readonly,assign,getter=connInfoClientKeyAlgorithm) NSString* connInfoClientKeyAlgorithm; - (NSString*)connInfoClientKeyAlgorithm; @property (nonatomic,readonly,assign,getter=connInfoClientKeyBits) int connInfoClientKeyBits; - (int)connInfoClientKeyBits; @property (nonatomic,readonly,assign,getter=connInfoClientKeyFingerprint) NSString* connInfoClientKeyFingerprint; - (NSString*)connInfoClientKeyFingerprint; @property (nonatomic,readonly,assign,getter=connInfoCloseReason) NSString* connInfoCloseReason; - (NSString*)connInfoCloseReason; @property (nonatomic,readonly,assign,getter=connInfoCompressionAlgorithmInbound) NSString* connInfoCompressionAlgorithmInbound; - (NSString*)connInfoCompressionAlgorithmInbound; @property (nonatomic,readonly,assign,getter=connInfoCompressionAlgorithmOutbound) NSString* connInfoCompressionAlgorithmOutbound; - (NSString*)connInfoCompressionAlgorithmOutbound; @property (nonatomic,readonly,assign,getter=connInfoEncryptionAlgorithmInbound) NSString* connInfoEncryptionAlgorithmInbound; - (NSString*)connInfoEncryptionAlgorithmInbound; @property (nonatomic,readonly,assign,getter=connInfoEncryptionAlgorithmOutbound) NSString* connInfoEncryptionAlgorithmOutbound; - (NSString*)connInfoEncryptionAlgorithmOutbound; @property (nonatomic,readonly,assign,getter=connInfoInboundEncryptionKeyBits) int connInfoInboundEncryptionKeyBits; - (int)connInfoInboundEncryptionKeyBits; @property (nonatomic,readonly,assign,getter=connInfoKexAlgorithm) NSString* connInfoKexAlgorithm; - (NSString*)connInfoKexAlgorithm; @property (nonatomic,readonly,assign,getter=connInfoKexBits) int connInfoKexBits; - (int)connInfoKexBits; @property (nonatomic,readonly,assign,getter=connInfoKexLines) NSString* connInfoKexLines; - (NSString*)connInfoKexLines; @property (nonatomic,readonly,assign,getter=connInfoMacAlgorithmInbound) NSString* connInfoMacAlgorithmInbound; - (NSString*)connInfoMacAlgorithmInbound; @property (nonatomic,readonly,assign,getter=connInfoMacAlgorithmOutbound) NSString* connInfoMacAlgorithmOutbound; - (NSString*)connInfoMacAlgorithmOutbound; @property (nonatomic,readonly,assign,getter=connInfoOutboundEncryptionKeyBits) int connInfoOutboundEncryptionKeyBits; - (int)connInfoOutboundEncryptionKeyBits; @property (nonatomic,readonly,assign,getter=connInfoPublicKeyAlgorithm) NSString* connInfoPublicKeyAlgorithm; - (NSString*)connInfoPublicKeyAlgorithm; @property (nonatomic,readonly,assign,getter=connInfoServerKeyBits) int connInfoServerKeyBits; - (int)connInfoServerKeyBits; @property (nonatomic,readonly,assign,getter=connInfoServerKeyFingerprint) NSString* connInfoServerKeyFingerprint; - (NSString*)connInfoServerKeyFingerprint; @property (nonatomic,readonly,assign,getter=connInfoServerSoftwareName) NSString* connInfoServerSoftwareName; - (NSString*)connInfoServerSoftwareName; @property (nonatomic,readonly,assign,getter=connInfoTotalBytesReceived) long long connInfoTotalBytesReceived; - (long long)connInfoTotalBytesReceived; @property (nonatomic,readonly,assign,getter=connInfoTotalBytesSent) long long connInfoTotalBytesSent; - (long long)connInfoTotalBytesSent; @property (nonatomic,readonly,assign,getter=connInfoVersion) int connInfoVersion; - (int)connInfoVersion;
Default Value
""
Remarks
Client's password is set by Password property. ;
ExitMessage Property (SSHClient Module)
Contains the last commands exit message.
Syntax
public var exitMessage: String { get {...} }
@property (nonatomic,readonly,assign,getter=exitMessage) NSString* exitMessage; - (NSString*)exitMessage;
Default Value
""
Remarks
Use this property to access the exit message of the last command or shell session. This property normally gets assigned if the command or shell was closed due to an error.
This property is read-only.
ExitSignal Property (SSHClient Module)
Contains the last commands exit signal.
Syntax
public var exitSignal: String { get {...} }
@property (nonatomic,readonly,assign,getter=exitSignal) NSString* exitSignal; - (NSString*)exitSignal;
Default Value
""
Remarks
Use this property to access the exit signal of the last command or shell session. This property normally gets assigned if the command or shell was closed due to an error.
This property is read-only.
ExitStatus Property (SSHClient Module)
Contains the last commands exit status.
Syntax
public var exitStatus: Int32 { get {...} }
@property (nonatomic,readonly,assign,getter=exitStatus) int exitStatus; - (int)exitStatus;
Default Value
0
Remarks
Check this property to obtain the exit status (also sometimes referred to as errorlevel) of the last command or shell session.
This property is read-only.
ExternalCrypto Property (SSHClient Module)
Provides access to external signing and DC parameters.
Syntax
public var externalCrypto: ExternalCrypto { get {...} }
@property (nonatomic,readwrite,assign,getter=externalCryptoAsyncDocumentID,setter=setExternalCryptoAsyncDocumentID:) NSString* externalCryptoAsyncDocumentID; - (NSString*)externalCryptoAsyncDocumentID; - (void)setExternalCryptoAsyncDocumentID :(NSString*)newExternalCryptoAsyncDocumentID; @property (nonatomic,readwrite,assign,getter=externalCryptoCustomParams,setter=setExternalCryptoCustomParams:) NSString* externalCryptoCustomParams; - (NSString*)externalCryptoCustomParams; - (void)setExternalCryptoCustomParams :(NSString*)newExternalCryptoCustomParams; @property (nonatomic,readwrite,assign,getter=externalCryptoData,setter=setExternalCryptoData:) NSString* externalCryptoData; - (NSString*)externalCryptoData; - (void)setExternalCryptoData :(NSString*)newExternalCryptoData; @property (nonatomic,readwrite,assign,getter=externalCryptoExternalHashCalculation,setter=setExternalCryptoExternalHashCalculation:) BOOL externalCryptoExternalHashCalculation; - (BOOL)externalCryptoExternalHashCalculation; - (void)setExternalCryptoExternalHashCalculation :(BOOL)newExternalCryptoExternalHashCalculation; @property (nonatomic,readwrite,assign,getter=externalCryptoHashAlgorithm,setter=setExternalCryptoHashAlgorithm:) NSString* externalCryptoHashAlgorithm; - (NSString*)externalCryptoHashAlgorithm; - (void)setExternalCryptoHashAlgorithm :(NSString*)newExternalCryptoHashAlgorithm; @property (nonatomic,readwrite,assign,getter=externalCryptoKeyID,setter=setExternalCryptoKeyID:) NSString* externalCryptoKeyID; - (NSString*)externalCryptoKeyID; - (void)setExternalCryptoKeyID :(NSString*)newExternalCryptoKeyID; @property (nonatomic,readwrite,assign,getter=externalCryptoKeySecret,setter=setExternalCryptoKeySecret:) NSString* externalCryptoKeySecret; - (NSString*)externalCryptoKeySecret; - (void)setExternalCryptoKeySecret :(NSString*)newExternalCryptoKeySecret; @property (nonatomic,readwrite,assign,getter=externalCryptoMethod,setter=setExternalCryptoMethod:) int externalCryptoMethod; - (int)externalCryptoMethod; - (void)setExternalCryptoMethod :(int)newExternalCryptoMethod; @property (nonatomic,readwrite,assign,getter=externalCryptoMode,setter=setExternalCryptoMode:) int externalCryptoMode; - (int)externalCryptoMode; - (void)setExternalCryptoMode :(int)newExternalCryptoMode; @property (nonatomic,readwrite,assign,getter=externalCryptoPublicKeyAlgorithm,setter=setExternalCryptoPublicKeyAlgorithm:) NSString* externalCryptoPublicKeyAlgorithm; - (NSString*)externalCryptoPublicKeyAlgorithm; - (void)setExternalCryptoPublicKeyAlgorithm :(NSString*)newExternalCryptoPublicKeyAlgorithm;
Default Value
""
Remarks
Client's password is set by Password property. ;
FIPSMode Property (SSHClient Module)
Reserved.
Syntax
public var fipsMode: Bool { get {...} set {...} }
@property (nonatomic,readwrite,assign,getter=FIPSMode,setter=setFIPSMode:) BOOL FIPSMode; - (BOOL)FIPSMode; - (void)setFIPSMode :(BOOL)newFIPSMode;
Default Value
False
Remarks
This property is reserved for future use.
Key Property (SSHClient Module)
Contains client's SSH key.
Syntax
public var key: SSHKey { get {...} set {...} }
@property (nonatomic,readonly,assign,getter=keyFingerprintSHA1) NSString* keyFingerprintSHA1; - (NSString*)keyFingerprintSHA1; @property (nonatomic,readonly,assign,getter=keyFingerprintSHA256) NSString* keyFingerprintSHA256; - (NSString*)keyFingerprintSHA256; @property (nonatomic,readwrite,assign,getter=keyHandle,setter=setKeyHandle:) long long keyHandle; - (long long)keyHandle; - (void)setKeyHandle :(long long)newKeyHandle;
Default Value
""
Remarks
Client's password is set by Password property. ;
Password Property (SSHClient Module)
Specifies user's password on the server.
Syntax
public var password: String { get {...} set {...} }
@property (nonatomic,readwrite,assign,getter=password,setter=setPassword:) NSString* password; - (NSString*)password; - (void)setPassword :(NSString*)newPassword;
Default Value
""
Remarks
Invalid password fires the AuthFailed event.
Proxy Property (SSHClient Module)
Allows connection through a proxy server.
Syntax
public var proxy: ProxySettings { get {...} }
@property (nonatomic,readwrite,assign,getter=proxySettingsAddress,setter=setProxySettingsAddress:) NSString* proxySettingsAddress; - (NSString*)proxySettingsAddress; - (void)setProxySettingsAddress :(NSString*)newProxySettingsAddress; @property (nonatomic,readwrite,assign,getter=proxySettingsAuthentication,setter=setProxySettingsAuthentication:) int proxySettingsAuthentication; - (int)proxySettingsAuthentication; - (void)setProxySettingsAuthentication :(int)newProxySettingsAuthentication; @property (nonatomic,readwrite,assign,getter=proxySettingsPassword,setter=setProxySettingsPassword:) NSString* proxySettingsPassword; - (NSString*)proxySettingsPassword; - (void)setProxySettingsPassword :(NSString*)newProxySettingsPassword; @property (nonatomic,readwrite,assign,getter=proxySettingsPort,setter=setProxySettingsPort:) int proxySettingsPort; - (int)proxySettingsPort; - (void)setProxySettingsPort :(int)newProxySettingsPort; @property (nonatomic,readwrite,assign,getter=proxySettingsProxyType,setter=setProxySettingsProxyType:) int proxySettingsProxyType; - (int)proxySettingsProxyType; - (void)setProxySettingsProxyType :(int)newProxySettingsProxyType; @property (nonatomic,readwrite,assign,getter=proxySettingsRequestHeaders,setter=setProxySettingsRequestHeaders:) NSString* proxySettingsRequestHeaders; - (NSString*)proxySettingsRequestHeaders; - (void)setProxySettingsRequestHeaders :(NSString*)newProxySettingsRequestHeaders; @property (nonatomic,readwrite,assign,getter=proxySettingsResponseBody,setter=setProxySettingsResponseBody:) NSString* proxySettingsResponseBody; - (NSString*)proxySettingsResponseBody; - (void)setProxySettingsResponseBody :(NSString*)newProxySettingsResponseBody; @property (nonatomic,readwrite,assign,getter=proxySettingsResponseHeaders,setter=setProxySettingsResponseHeaders:) NSString* proxySettingsResponseHeaders; - (NSString*)proxySettingsResponseHeaders; - (void)setProxySettingsResponseHeaders :(NSString*)newProxySettingsResponseHeaders; @property (nonatomic,readwrite,assign,getter=proxySettingsUseIPv6,setter=setProxySettingsUseIPv6:) BOOL proxySettingsUseIPv6; - (BOOL)proxySettingsUseIPv6; - (void)setProxySettingsUseIPv6 :(BOOL)newProxySettingsUseIPv6; @property (nonatomic,readwrite,assign,getter=proxySettingsUseProxy,setter=setProxySettingsUseProxy:) BOOL proxySettingsUseProxy; - (BOOL)proxySettingsUseProxy; - (void)setProxySettingsUseProxy :(BOOL)newProxySettingsUseProxy; @property (nonatomic,readwrite,assign,getter=proxySettingsUsername,setter=setProxySettingsUsername:) NSString* proxySettingsUsername; - (NSString*)proxySettingsUsername; - (void)setProxySettingsUsername :(NSString*)newProxySettingsUsername;
Default Value
""
Remarks
Client's password is set by Password property. ;
ServerKey Property (SSHClient Module)
Returns server's public key.
Syntax
public var serverKey: SSHKey { get {...} }
@property (nonatomic,readonly,assign,getter=serverKeyAlgorithm) NSString* serverKeyAlgorithm; - (NSString*)serverKeyAlgorithm; @property (nonatomic,readonly,assign,getter=serverKeyBits) int serverKeyBits; - (int)serverKeyBits; @property (nonatomic,readonly,assign,getter=serverKeyComment) NSString* serverKeyComment; - (NSString*)serverKeyComment; @property (nonatomic,readonly,assign,getter=serverKeyCurve) NSString* serverKeyCurve; - (NSString*)serverKeyCurve; @property (nonatomic,readonly,assign,getter=serverKeyDSSG) NSData* serverKeyDSSG; - (NSData*)serverKeyDSSG; @property (nonatomic,readonly,assign,getter=serverKeyDSSP) NSData* serverKeyDSSP; - (NSData*)serverKeyDSSP; @property (nonatomic,readonly,assign,getter=serverKeyDSSQ) NSData* serverKeyDSSQ; - (NSData*)serverKeyDSSQ; @property (nonatomic,readonly,assign,getter=serverKeyDSSX) NSData* serverKeyDSSX; - (NSData*)serverKeyDSSX; @property (nonatomic,readonly,assign,getter=serverKeyDSSY) NSData* serverKeyDSSY; - (NSData*)serverKeyDSSY; @property (nonatomic,readonly,assign,getter=serverKeyECCD) NSData* serverKeyECCD; - (NSData*)serverKeyECCD; @property (nonatomic,readonly,assign,getter=serverKeyECCQX) NSData* serverKeyECCQX; - (NSData*)serverKeyECCQX; @property (nonatomic,readonly,assign,getter=serverKeyECCQY) NSData* serverKeyECCQY; - (NSData*)serverKeyECCQY; @property (nonatomic,readonly,assign,getter=serverKeyEdPrivate) NSData* serverKeyEdPrivate; - (NSData*)serverKeyEdPrivate; @property (nonatomic,readonly,assign,getter=serverKeyEdPublic) NSData* serverKeyEdPublic; - (NSData*)serverKeyEdPublic; @property (nonatomic,readonly,assign,getter=serverKeyFingerprintMD5) NSString* serverKeyFingerprintMD5; - (NSString*)serverKeyFingerprintMD5; @property (nonatomic,readonly,assign,getter=serverKeyFingerprintSHA1) NSString* serverKeyFingerprintSHA1; - (NSString*)serverKeyFingerprintSHA1; @property (nonatomic,readonly,assign,getter=serverKeyFingerprintSHA256) NSString* serverKeyFingerprintSHA256; - (NSString*)serverKeyFingerprintSHA256; @property (nonatomic,readonly,assign,getter=serverKeyHandle) long long serverKeyHandle; - (long long)serverKeyHandle; @property (nonatomic,readonly,assign,getter=serverKeyIsExtractable) BOOL serverKeyIsExtractable; - (BOOL)serverKeyIsExtractable; @property (nonatomic,readonly,assign,getter=serverKeyIsPrivate) BOOL serverKeyIsPrivate; - (BOOL)serverKeyIsPrivate; @property (nonatomic,readonly,assign,getter=serverKeyIsPublic) BOOL serverKeyIsPublic; - (BOOL)serverKeyIsPublic; @property (nonatomic,readonly,assign,getter=serverKeyKDFRounds) int serverKeyKDFRounds; - (int)serverKeyKDFRounds; @property (nonatomic,readonly,assign,getter=serverKeyKDFSalt) NSData* serverKeyKDFSalt; - (NSData*)serverKeyKDFSalt; @property (nonatomic,readonly,assign,getter=serverKeyKeyFormat) int serverKeyKeyFormat; - (int)serverKeyKeyFormat; @property (nonatomic,readonly,assign,getter=serverKeyKeyProtectionAlgorithm) NSString* serverKeyKeyProtectionAlgorithm; - (NSString*)serverKeyKeyProtectionAlgorithm; @property (nonatomic,readonly,assign,getter=serverKeyRSAExponent) NSData* serverKeyRSAExponent; - (NSData*)serverKeyRSAExponent; @property (nonatomic,readonly,assign,getter=serverKeyRSAIQMP) NSData* serverKeyRSAIQMP; - (NSData*)serverKeyRSAIQMP; @property (nonatomic,readonly,assign,getter=serverKeyRSAModulus) NSData* serverKeyRSAModulus; - (NSData*)serverKeyRSAModulus; @property (nonatomic,readonly,assign,getter=serverKeyRSAP) NSData* serverKeyRSAP; - (NSData*)serverKeyRSAP; @property (nonatomic,readonly,assign,getter=serverKeyRSAPrivateExponent) NSData* serverKeyRSAPrivateExponent; - (NSData*)serverKeyRSAPrivateExponent; @property (nonatomic,readonly,assign,getter=serverKeyRSAQ) NSData* serverKeyRSAQ; - (NSData*)serverKeyRSAQ; @property (nonatomic,readonly,assign,getter=serverKeySubject) NSString* serverKeySubject; - (NSString*)serverKeySubject;
Default Value
""
Remarks
Client's password is set by Password property. ;
SocketSettings Property (SSHClient Module)
Manages network connection settings.
Syntax
public var socketSettings: SocketSettings { get {...} }
@property (nonatomic,readwrite,assign,getter=socketDNSMode,setter=setSocketDNSMode:) int socketDNSMode; - (int)socketDNSMode; - (void)setSocketDNSMode :(int)newSocketDNSMode; @property (nonatomic,readwrite,assign,getter=socketDNSPort,setter=setSocketDNSPort:) int socketDNSPort; - (int)socketDNSPort; - (void)setSocketDNSPort :(int)newSocketDNSPort; @property (nonatomic,readwrite,assign,getter=socketDNSQueryTimeout,setter=setSocketDNSQueryTimeout:) int socketDNSQueryTimeout; - (int)socketDNSQueryTimeout; - (void)setSocketDNSQueryTimeout :(int)newSocketDNSQueryTimeout; @property (nonatomic,readwrite,assign,getter=socketDNSServers,setter=setSocketDNSServers:) NSString* socketDNSServers; - (NSString*)socketDNSServers; - (void)setSocketDNSServers :(NSString*)newSocketDNSServers; @property (nonatomic,readwrite,assign,getter=socketDNSTotalTimeout,setter=setSocketDNSTotalTimeout:) int socketDNSTotalTimeout; - (int)socketDNSTotalTimeout; - (void)setSocketDNSTotalTimeout :(int)newSocketDNSTotalTimeout; @property (nonatomic,readwrite,assign,getter=socketIncomingSpeedLimit,setter=setSocketIncomingSpeedLimit:) int socketIncomingSpeedLimit; - (int)socketIncomingSpeedLimit; - (void)setSocketIncomingSpeedLimit :(int)newSocketIncomingSpeedLimit; @property (nonatomic,readwrite,assign,getter=socketLocalAddress,setter=setSocketLocalAddress:) NSString* socketLocalAddress; - (NSString*)socketLocalAddress; - (void)setSocketLocalAddress :(NSString*)newSocketLocalAddress; @property (nonatomic,readwrite,assign,getter=socketLocalPort,setter=setSocketLocalPort:) int socketLocalPort; - (int)socketLocalPort; - (void)setSocketLocalPort :(int)newSocketLocalPort; @property (nonatomic,readwrite,assign,getter=socketOutgoingSpeedLimit,setter=setSocketOutgoingSpeedLimit:) int socketOutgoingSpeedLimit; - (int)socketOutgoingSpeedLimit; - (void)setSocketOutgoingSpeedLimit :(int)newSocketOutgoingSpeedLimit; @property (nonatomic,readwrite,assign,getter=socketTimeout,setter=setSocketTimeout:) int socketTimeout; - (int)socketTimeout; - (void)setSocketTimeout :(int)newSocketTimeout; @property (nonatomic,readwrite,assign,getter=socketUseIPv6,setter=setSocketUseIPv6:) BOOL socketUseIPv6; - (BOOL)socketUseIPv6; - (void)setSocketUseIPv6 :(BOOL)newSocketUseIPv6;
Default Value
""
Remarks
Client's password is set by Password property. ;
SSHSettings Property (SSHClient Module)
Provides access to SSH connection settings.
Syntax
public var sshSettings: SSHSettings { get {...} }
@property (nonatomic,readwrite,assign,getter=SSHSettingsAutoAdjustCiphers,setter=setSSHSettingsAutoAdjustCiphers:) BOOL SSHSettingsAutoAdjustCiphers; - (BOOL)SSHSettingsAutoAdjustCiphers; - (void)setSSHSettingsAutoAdjustCiphers :(BOOL)newSSHSettingsAutoAdjustCiphers; @property (nonatomic,readwrite,assign,getter=SSHSettingsBaseConfiguration,setter=setSSHSettingsBaseConfiguration:) int SSHSettingsBaseConfiguration; - (int)SSHSettingsBaseConfiguration; - (void)setSSHSettingsBaseConfiguration :(int)newSSHSettingsBaseConfiguration; @property (nonatomic,readwrite,assign,getter=SSHSettingsCompressionAlgorithms,setter=setSSHSettingsCompressionAlgorithms:) NSString* SSHSettingsCompressionAlgorithms; - (NSString*)SSHSettingsCompressionAlgorithms; - (void)setSSHSettingsCompressionAlgorithms :(NSString*)newSSHSettingsCompressionAlgorithms; @property (nonatomic,readwrite,assign,getter=SSHSettingsCompressionLevel,setter=setSSHSettingsCompressionLevel:) int SSHSettingsCompressionLevel; - (int)SSHSettingsCompressionLevel; - (void)setSSHSettingsCompressionLevel :(int)newSSHSettingsCompressionLevel; @property (nonatomic,readwrite,assign,getter=SSHSettingsDefaultWindowSize,setter=setSSHSettingsDefaultWindowSize:) int SSHSettingsDefaultWindowSize; - (int)SSHSettingsDefaultWindowSize; - (void)setSSHSettingsDefaultWindowSize :(int)newSSHSettingsDefaultWindowSize; @property (nonatomic,readwrite,assign,getter=SSHSettingsEncryptionAlgorithms,setter=setSSHSettingsEncryptionAlgorithms:) NSString* SSHSettingsEncryptionAlgorithms; - (NSString*)SSHSettingsEncryptionAlgorithms; - (void)setSSHSettingsEncryptionAlgorithms :(NSString*)newSSHSettingsEncryptionAlgorithms; @property (nonatomic,readwrite,assign,getter=SSHSettingsForceCompression,setter=setSSHSettingsForceCompression:) BOOL SSHSettingsForceCompression; - (BOOL)SSHSettingsForceCompression; - (void)setSSHSettingsForceCompression :(BOOL)newSSHSettingsForceCompression; @property (nonatomic,readwrite,assign,getter=SSHSettingsGSSAuthTypes,setter=setSSHSettingsGSSAuthTypes:) NSString* SSHSettingsGSSAuthTypes; - (NSString*)SSHSettingsGSSAuthTypes; - (void)setSSHSettingsGSSAuthTypes :(NSString*)newSSHSettingsGSSAuthTypes; @property (nonatomic,readwrite,assign,getter=SSHSettingsGSSDelegateCreds,setter=setSSHSettingsGSSDelegateCreds:) BOOL SSHSettingsGSSDelegateCreds; - (BOOL)SSHSettingsGSSDelegateCreds; - (void)setSSHSettingsGSSDelegateCreds :(BOOL)newSSHSettingsGSSDelegateCreds; @property (nonatomic,readwrite,assign,getter=SSHSettingsGSSHostname,setter=setSSHSettingsGSSHostname:) NSString* SSHSettingsGSSHostname; - (NSString*)SSHSettingsGSSHostname; - (void)setSSHSettingsGSSHostname :(NSString*)newSSHSettingsGSSHostname; @property (nonatomic,readwrite,assign,getter=SSHSettingsGSSLib,setter=setSSHSettingsGSSLib:) NSString* SSHSettingsGSSLib; - (NSString*)SSHSettingsGSSLib; - (void)setSSHSettingsGSSLib :(NSString*)newSSHSettingsGSSLib; @property (nonatomic,readwrite,assign,getter=SSHSettingsGSSMechanisms,setter=setSSHSettingsGSSMechanisms:) NSString* SSHSettingsGSSMechanisms; - (NSString*)SSHSettingsGSSMechanisms; - (void)setSSHSettingsGSSMechanisms :(NSString*)newSSHSettingsGSSMechanisms; @property (nonatomic,readwrite,assign,getter=SSHSettingsGSSProtocols,setter=setSSHSettingsGSSProtocols:) NSString* SSHSettingsGSSProtocols; - (NSString*)SSHSettingsGSSProtocols; - (void)setSSHSettingsGSSProtocols :(NSString*)newSSHSettingsGSSProtocols; @property (nonatomic,readwrite,assign,getter=SSHSettingsHandshakeTimeout,setter=setSSHSettingsHandshakeTimeout:) int SSHSettingsHandshakeTimeout; - (int)SSHSettingsHandshakeTimeout; - (void)setSSHSettingsHandshakeTimeout :(int)newSSHSettingsHandshakeTimeout; @property (nonatomic,readwrite,assign,getter=SSHSettingsKexAlgorithms,setter=setSSHSettingsKexAlgorithms:) NSString* SSHSettingsKexAlgorithms; - (NSString*)SSHSettingsKexAlgorithms; - (void)setSSHSettingsKexAlgorithms :(NSString*)newSSHSettingsKexAlgorithms; @property (nonatomic,readwrite,assign,getter=SSHSettingsMacAlgorithms,setter=setSSHSettingsMacAlgorithms:) NSString* SSHSettingsMacAlgorithms; - (NSString*)SSHSettingsMacAlgorithms; - (void)setSSHSettingsMacAlgorithms :(NSString*)newSSHSettingsMacAlgorithms; @property (nonatomic,readwrite,assign,getter=SSHSettingsMaxSSHPacketSize,setter=setSSHSettingsMaxSSHPacketSize:) int SSHSettingsMaxSSHPacketSize; - (int)SSHSettingsMaxSSHPacketSize; - (void)setSSHSettingsMaxSSHPacketSize :(int)newSSHSettingsMaxSSHPacketSize; @property (nonatomic,readwrite,assign,getter=SSHSettingsMinWindowSize,setter=setSSHSettingsMinWindowSize:) int SSHSettingsMinWindowSize; - (int)SSHSettingsMinWindowSize; - (void)setSSHSettingsMinWindowSize :(int)newSSHSettingsMinWindowSize; @property (nonatomic,readwrite,assign,getter=SSHSettingsObfuscateHandshake,setter=setSSHSettingsObfuscateHandshake:) BOOL SSHSettingsObfuscateHandshake; - (BOOL)SSHSettingsObfuscateHandshake; - (void)setSSHSettingsObfuscateHandshake :(BOOL)newSSHSettingsObfuscateHandshake; @property (nonatomic,readwrite,assign,getter=SSHSettingsObfuscationPassword,setter=setSSHSettingsObfuscationPassword:) NSString* SSHSettingsObfuscationPassword; - (NSString*)SSHSettingsObfuscationPassword; - (void)setSSHSettingsObfuscationPassword :(NSString*)newSSHSettingsObfuscationPassword; @property (nonatomic,readwrite,assign,getter=SSHSettingsPublicKeyAlgorithms,setter=setSSHSettingsPublicKeyAlgorithms:) NSString* SSHSettingsPublicKeyAlgorithms; - (NSString*)SSHSettingsPublicKeyAlgorithms; - (void)setSSHSettingsPublicKeyAlgorithms :(NSString*)newSSHSettingsPublicKeyAlgorithms; @property (nonatomic,readwrite,assign,getter=SSHSettingsRequestPasswordChange,setter=setSSHSettingsRequestPasswordChange:) BOOL SSHSettingsRequestPasswordChange; - (BOOL)SSHSettingsRequestPasswordChange; - (void)setSSHSettingsRequestPasswordChange :(BOOL)newSSHSettingsRequestPasswordChange; @property (nonatomic,readwrite,assign,getter=SSHSettingsSoftwareName,setter=setSSHSettingsSoftwareName:) NSString* SSHSettingsSoftwareName; - (NSString*)SSHSettingsSoftwareName; - (void)setSSHSettingsSoftwareName :(NSString*)newSSHSettingsSoftwareName; @property (nonatomic,readwrite,assign,getter=SSHSettingsTrustAllKeys,setter=setSSHSettingsTrustAllKeys:) BOOL SSHSettingsTrustAllKeys; - (BOOL)SSHSettingsTrustAllKeys; - (void)setSSHSettingsTrustAllKeys :(BOOL)newSSHSettingsTrustAllKeys; @property (nonatomic,readwrite,assign,getter=SSHSettingsUseAuthAgent,setter=setSSHSettingsUseAuthAgent:) BOOL SSHSettingsUseAuthAgent; - (BOOL)SSHSettingsUseAuthAgent; - (void)setSSHSettingsUseAuthAgent :(BOOL)newSSHSettingsUseAuthAgent; @property (nonatomic,readwrite,assign,getter=SSHSettingsVersions,setter=setSSHSettingsVersions:) int SSHSettingsVersions; - (int)SSHSettingsVersions; - (void)setSSHSettingsVersions :(int)newSSHSettingsVersions;
Default Value
""
Remarks
Client's password is set by Password property. ;
Subsystem Property (SSHClient Module)
Specifies the subsystem to request from the server.
Syntax
public var subsystem: String { get {...} set {...} }
@property (nonatomic,readwrite,assign,getter=subsystem,setter=setSubsystem:) NSString* subsystem; - (NSString*)subsystem; - (void)setSubsystem :(NSString*)newSubsystem;
Default Value
""
Remarks
Subsystem is a special form of an SSH channel. It is typically used to transfer third-party protocol data, with SFTP being the most widely known.
You can tell class to set up a subsystem connection (rather than a shell or command) by assigning the subsystem name to this property.
Terminal Property (SSHClient Module)
Provides access to SSH terminal settings object.
Syntax
public var terminal: SSHTerm { get {...} }
@property (nonatomic,readwrite,assign,getter=terminalCols,setter=setTerminalCols:) int terminalCols; - (int)terminalCols; - (void)setTerminalCols :(int)newTerminalCols; @property (nonatomic,readwrite,assign,getter=terminalEnvironment,setter=setTerminalEnvironment:) NSString* terminalEnvironment; - (NSString*)terminalEnvironment; - (void)setTerminalEnvironment :(NSString*)newTerminalEnvironment; @property (nonatomic,readwrite,assign,getter=terminalEOLChar,setter=setTerminalEOLChar:) NSData* terminalEOLChar; - (NSData*)terminalEOLChar; - (void)setTerminalEOLChar :(NSData*)newTerminalEOLChar; @property (nonatomic,readwrite,assign,getter=terminalHeight,setter=setTerminalHeight:) int terminalHeight; - (int)terminalHeight; - (void)setTerminalHeight :(int)newTerminalHeight; @property (nonatomic,readwrite,assign,getter=terminalOpcodes,setter=setTerminalOpcodes:) NSString* terminalOpcodes; - (NSString*)terminalOpcodes; - (void)setTerminalOpcodes :(NSString*)newTerminalOpcodes; @property (nonatomic,readwrite,assign,getter=terminalProtocol,setter=setTerminalProtocol:) NSString* terminalProtocol; - (NSString*)terminalProtocol; - (void)setTerminalProtocol :(NSString*)newTerminalProtocol; @property (nonatomic,readwrite,assign,getter=terminalRequestPty,setter=setTerminalRequestPty:) BOOL terminalRequestPty; - (BOOL)terminalRequestPty; - (void)setTerminalRequestPty :(BOOL)newTerminalRequestPty; @property (nonatomic,readwrite,assign,getter=terminalRows,setter=setTerminalRows:) int terminalRows; - (int)terminalRows; - (void)setTerminalRows :(int)newTerminalRows; @property (nonatomic,readwrite,assign,getter=terminalWidth,setter=setTerminalWidth:) int terminalWidth; - (int)terminalWidth; - (void)setTerminalWidth :(int)newTerminalWidth;
Default Value
""
Remarks
Client's password is set by Password property. ;
TrustedKeysFile Property (SSHClient Module)
Path to the file containing public keys of authorized servers.
Syntax
public var trustedKeysFile: String { get {...} set {...} }
@property (nonatomic,readwrite,assign,getter=trustedKeysFile,setter=setTrustedKeysFile:) NSString* trustedKeysFile; - (NSString*)trustedKeysFile; - (void)setTrustedKeysFile :(NSString*)newTrustedKeysFile;
Default Value
""
Remarks
Path to the file containing public keys of authorized servers.
Username Property (SSHClient Module)
Specifies client's username on the server.
Syntax
public var username: String { get {...} set {...} }
@property (nonatomic,readwrite,assign,getter=username,setter=setUsername:) NSString* username; - (NSString*)username; - (void)setUsername :(NSString*)newUsername;
Default Value
""
Remarks
Client's password is set by Password property. ;
Config Method (SSHClient Module)
Sets or retrieves a configuration setting.
Syntax
- (NSString*)config:(NSString*)configurationString;
Remarks
Config is a generic method available in every class. It is used to set and retrieve configuration settings for the class.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
Connect Method (SSHClient Module)
Establishes connection to an SSH server.
Syntax
- (void)connect:(NSString*)address :(int)port;
Remarks
Use this method to connect to the SSH server by providing its Address and Port.
Before connecting to the server you might want to set up your credentials using Username and Password properties. You might also need to configure the server key validation routine. You can do this by subscribing to KnownKeyReceived and UnknownKeyReceived events and implementing the event handlers as required.
Adjust AsyncMode before connecting to switch the component to either synchronous or asynchronous mode. In synchronous mode, all the calls to the component, such as Connect or SendBytes, are executed within the context of the caller thread, and block until the action completes. In asynchronous mode, the component runs the SSH session in a background thread, which makes all such calls return immediately. Find out more about the modes in the AsyncMode topic.
ConnectAndExec Method (SSHClient Module)
Connects to an SSH server and executes a command in one go.
Syntax
public func connectAndExec(address: String, port: Int32, command: String, wantStdout: Bool, wantStdErr: Bool) throws -> Data
- (NSData*)connectAndExec:(NSString*)address :(int)port :(NSString*)command :(BOOL)wantStdout :(BOOL)wantStdErr;
Remarks
Use this method to connect to an SSH server at Address and Port and execute a command. The method returns the output of the executed command.
This method is a handy shortcut for running non-interactive commands. It encapsulates calls to Connect, Receive, Disconnect internally to save you time and space.
Please note that ConnectAndExec always runs synchronously, thus ignoring the AsyncMode setting.
Disconnect Method (SSHClient Module)
Closes connection to the SSH server.
Syntax
public func disconnect() throws -> Void
- (void)disconnect;
Remarks
Call this method to terminate the active SSH connection.
Please note that in some cases the component may still have some inbound data cached internally even after the connection is closed. You can read that data out using Receive and/or ReceiveBytes methods.
DoAction Method (SSHClient Module)
Performs an additional action.
Syntax
- (NSString*)doAction:(NSString*)actionID :(NSString*)actionParams;
Remarks
DoAction is a generic method available in every class. It is used to perform an additional action introduced after the product major release. The list of actions is not fixed, and may be flexibly extended over time.
The unique identifier of the action is provided in ActionID parameter. ActionParams contains a list of parameters for the action in the form of PARAM1=VALUE1;PARAM2=VALUE2;....
Ping Method (SSHClient Module)
Sends a keep-alive request to the SSH server.
Syntax
public func ping() throws -> Void
- (void)ping;
Remarks
Use this method to send a keep-alive message to the SSH server. Keep-alive messages are empty data packets which carry no useful information but are a handy way of checking if the connection is still alive.
Poll Method (SSHClient Module)
Checks whether there is any inbound data readily available.
Syntax
Remarks
Use this method to check whether there is any incoming data available in the connection. If this method returns true, you can read the data with Receive or ReceiveBytes calls.
Use the Milliseconds parameter to tell the component how long it can wait for the data to arrive.
Receive Method (SSHClient Module)
Reads a portion of received data into a string.
Syntax
public func receive() throws -> String
- (NSString*)receive;
Remarks
Use this method to read out a piece of data received from the server into a string.
Note that in synchronous mode this method may block in the absence of any inbound data until the next piece of data is received from the server. Use Poll to check if there is any data in the connection that is immediately available for reading.
In asynchronous mode a good time to call this method is upon receiving a read notification in DataReceived event handler. When working in asynchronous mode, this call returns immediately.
This method only returns data that arrives via the stdout channel. Use ReceiveFrom to read stderr data.
ReceiveBytes Method (SSHClient Module)
Reads a portion of received data into a byte array.
Syntax
Remarks
Use this method to read out a piece of data received from the server into a byte array. Control the maximum length of the data chunk with the MaxLen parameter.
Note that in synchronous mode this method may block in the absence of any inbound data until the next piece of data is received from the server. Use Poll to check if there is any data in the connection that is immediately available for reading.
In asynchronous mode a good time to call this method is upon receiving a read notification in DataReceived event handler. When working in asynchronous mode, this call returns immediately.
This method only returns data that arrives via the stdout channel. Use ReceiveBytesFrom to read stderr data.
ReceiveBytesFrom Method (SSHClient Module)
Reads a portion of data received via a specific channel into a byte array.
Syntax
- (NSData*)receiveBytesFrom:(int)channel :(int)maxLen;
Remarks
Use this method to read out a piece of data received from the server into a byte array. Specify the channel that you are interested in reading from (0 for stdout, 1 for stderr) via the Channel parameter, and control the maximum length of the data chunk with the MaxLen parameter.
Note that in synchronous mode this method may block in the absence of any inbound data until the next piece of data is received from the server. Use Poll to check if there is any data in the connection that is immediately available for reading.
In asynchronous mode a good time to call this method is upon receiving a read notification in DataReceived event handler. When working in asynchronous mode, this call returns immediately.
Please also note that stdout and stderr channels are fully independent, which implies that data arriving via each channel should be read out separately.
ReceiveFrom Method (SSHClient Module)
Reads a portion of data received via a specific channel into a string.
Syntax
Remarks
Use this method to read out a piece of data received from the server into a string. Use the Channel parameter to specify the channel that you would like to read from (0 for stdout, 1 for stderr).
Note that in synchronous mode this method may block in the absence of any inbound data until the next piece of data is received from the server. Use Poll to check if there is any data in the connection that is immediately available for reading.
In asynchronous mode a good time to call this method is upon receiving a read notification in DataReceived event handler. When working in asynchronous mode, this call returns immediately.
Send Method (SSHClient Module)
Sends a string to the server.
Syntax
- (void)send:(NSString*)dataStr :(BOOL)addEOL;
Remarks
Use this method to send DataStr to the remote command's stdin channel. Set the AddEOL parameter to true to append the end-of-line character to the string automatically.
Note that in synchronous mode this method may block until the whole string is commited to the network connection. In asynchronous mode this method returns immediately; the application is eventually notified that the data has been sent via the DataSent event.
SendBytes Method (SSHClient Module)
Sends an array of bytes to the server.
Syntax
Remarks
Use this method to send Data to the remote command's stdin channel.
Note that in synchronous mode this method may block until the whole byte array is commited to the network connection. In asynchronous mode this method returns immediately; the application is eventually notified that the data has been sent via the DataSent event.
SendSpecial Method (SSHClient Module)
Sends a special character to the server or remote command.
Syntax
- (void)sendSpecial:(NSString*)specialChar;
Remarks
Use this method to send a special or control character to the SSH server or the command being executed. Specify the character id via the SpecialChar parameter.
Currently the only supported special character is "eof", which is sometimes used as a way to close the stdin channel gracefully.
AuthAttempt Event (SSHClient Module)
Fires when a single authentication attempt is performed.
Syntax
func onAuthAttempt(authType: Int32)
- (void)onAuthAttempt:(int)authType;
Remarks
This event is fired each time a single authentication attempt is performed. AuthType parameter specifies the type of authentication. Note, this event could be fired more than once if the client tries different authentication methods one after another.
AuthFailed Event (SSHClient Module)
Fires when a single authentication attempt is failed.
Syntax
func onAuthFailed(authenticationType: Int32)
- (void)onAuthFailed:(int)authenticationType;
Remarks
This event is fired each time a single authentication attempt fails. AuthType parameter specifies the type of authentication.
As SSH may try a number of authentication attempts of different types or with different parameters (such as public keys) during one session, this event may be fired more than once. It is not critical and may not lead to closing of the connection.
AuthSucceeded Event (SSHClient Module)
Reports a successful authentication.
Syntax
func onAuthSucceeded()
- (void)onAuthSucceeded;
Remarks
This event may be preceded by some AuthFailed events if the client tries different authentication methods one after another.
Banner Event (SSHClient Module)
Reports the receipt of the Hello message from the server.
Syntax
Remarks
SFPTClient fires this event when it receives hello message from the server.
CommandCompleted Event (SSHClient Module)
Signifies completion of the command execution.
Syntax
func onCommandCompleted(command: String, exitStatus: Int32, exitMessage: String, exitSignal: String)
- (void)onCommandCompleted:(NSString*)command :(int)exitStatus :(NSString*)exitMessage :(NSString*)exitSignal;
Remarks
Subscribe to this event to be notified about completion of the remote command execution. This event fires for every command in the Commands list. The Command parameter indicates the command being completed.
ExitStatus specifies the command's return code. ExitMessage or ExitSignal parameters provide error details if the command execution was terminated forcefully,
CommandStart Event (SSHClient Module)
Marks the commencement of a command execution.
Syntax
func onCommandStart(command: String)
- (void)onCommandStart:(NSString*)command;
Remarks
Subscribe to this event to be notified about the start of execution of a remote command. The Command parameter indicates the command being started.
This event is fired for all commands in the Commands list, in order. The completion of the command is reported via the CommandCompleted event.
Connect Event (SSHClient Module)
This event is fired when an SSH session has been established.
Syntax
func onConnect()
- (void)onConnect;
Remarks
Use this event to track the moment when SSH session has been set up.
DataReceived Event (SSHClient Module)
Reports receipt of another chunk of data from the server.
Syntax
- (void)onDataReceived:(int)channel :(int)bytesReceived :(int)totalBytesPending;
Remarks
This event fires in asynchronous mode to report the receipt of another chunk of data from the server. Use Receive or ReceiveBytes methods to read out the received data.
The Channel parameter indicates the channel on which the data was received: stdout (0) or stderr (1). BytesReceived specify the size of the newly received chunk, and TotalBytesPending contain the total number of bytes available for reading.
Please note that just like other asynchronous mode events this event may fire from a secondary thread. Please make sure your code is prepared for that by using appropriate synchronization facilities.
This event does not fire in synchronous mode.
DataSent Event (SSHClient Module)
Notifies the application that a piece of data has been sent to the server.
Syntax
- (void)onDataSent:(int)bytesSent :(int)bytesPending;
Remarks
Subscribe to this event to be notified about the outbound data flow. This event fires following a call to Send or SendBytes methods to notify the application that the data provided has been sent to the server. This event may fire more than once for each Send or SendBytes call, subject to the volume of data being sent and the settings of the server.
The BytesSent parameter specifies the number of bytes that has just been sent to the server. The BytesPending indicate the number of bytes that remain cached in the internal buffer. Any bytes cached in such way will be sent again on the next available opportunity and reported via a separate DataSent event invocation.
Please note that just like other asynchronous mode events this event may fire from a secondary thread. Please make sure your code is prepared for that by using appropriate synchronization facilities.
This event does not fire in synchronous mode.
Disconnect Event (SSHClient Module)
This event is fired when the SFTP subsystem connection is closed.
Syntax
func onDisconnect(closeReason: Int32)
- (void)onDisconnect:(int)closeReason;
Remarks
Do not perform any file operations after this event has been fired.
Error Event (SSHClient Module)
Information about errors during SFTP connection.
Syntax
- (void)onError:(int)errorCode :(NSString*)description;
Remarks
The event is fired in case of exceptional conditions during data transfer.
ErrorCode contains an error code and Description contains a textual description of the error. For a list of error codes please refer to SFTP.
ExternalSign Event (SSHClient Module)
Handles remote or external signing initiated by the SignExternal method or other source.
Syntax
func onExternalSign(operationId: String, hashAlgorithm: String, pars: String, data: String, signedData: inout String)
- (void)onExternalSign:(NSString*)operationId :(NSString*)hashAlgorithm :(NSString*)pars :(NSString*)data :(NSString**)signedData;
Remarks
Assign a handler to this event if you need to delegate a low-level signing operation to an external, remote, or custom signing engine. Depending on the settings, the handler will receive a hashed or unhashed value to be signed.
The event handler must pass the value of Data to the signer, obtain the signature, and pass it back to the component via SignedData parameter.
OperationId provides a comment about the operation and its origin. It depends on the exact component being used, and may be empty. HashAlgorithm specifies the hash algorithm being used for the operation, and Pars contain algorithm-dependent parameters.
The component uses base16 (hex) encoding for Data, SignedData, and Pars parameters. If your signing engine uses a different input and output encoding, you may need to decode and/or encode the data before and/or after the signing.
A sample MD5 hash encoded in base16: a0dee2a0382afbb09120ffa7ccd8a152 - lower case base16 A0DEE2A0382AFBB09120FFA7CCD8A152 - upper case base16
A sample event handler that uses a .NET RSACryptoServiceProvider class may look like the following:
signer.OnExternalSign += (s, e) =>
{
var cert = new X509Certificate2("cert.pfx", "", X509KeyStorageFlags.Exportable);
var key = (RSACryptoServiceProvider)cert.PrivateKey;
var dataToSign = e.Data.FromBase16String();
var signedData = key.SignHash(dataToSign, "2.16.840.1.101.3.4.2.1");
e.SignedData = signedData.ToBase16String();
};
KnownKeyReceived Event (SSHClient Module)
Signals that the server has introduced itself with a known key.
Syntax
- (void)onKnownKeyReceived:(NSString*)algorithm :(int)bits :(NSString*)fingerprintSHA256;
Remarks
The class fires this event to tell the application that the server has introduced itself with a known key from TrustedKeysFile.
The details of the key are provided: Algorithm and Bits specify the key algorithm and the number of bits. FingerprintSHA256 contains the key's fingerprint.
Use ServerKey to access more key details.
Notification Event (SSHClient Module)
This event notifies the application about an underlying control flow event.
Syntax
- (void)onNotification:(NSString*)eventID :(NSString*)eventParam;
Remarks
The class fires this event to let the application know about some event, occurrence, or milestone in the component. For example, it may fire to report completion of the document processing. The list of events being reported is not fixed, and may be flexibly extended over time.
The unique identifier of the event is provided in EventID parameter. EventParam contains any parameters accompanying the occurrence. Depending on the type of the component, the exact action it is performing, or the document being processed, one or both may be omitted.
PasswordChangeRequest Event (SSHClient Module)
This event is fired when a password change is requested.
Syntax
func onPasswordChangeRequest(prompt: String, newPassword: inout String, cancel: inout Bool)
- (void)onPasswordChangeRequest:(NSString*)prompt :(NSString**)newPassword :(int*)cancel;
Remarks
This event is fired by the class when a password change is requested by the server. Prompt contains the password prompt message. Handler should either provide the new password via NewPassword, or deny the request by setting Cancel to true.
PrivateKeyNeeded Event (SSHClient Module)
This event is fired when client's public key was accepted by the server, but the corresponding secret key is not available.
Syntax
func onPrivateKeyNeeded(skip: inout Bool)
- (void)onPrivateKeyNeeded:(int*)skip;
Remarks
Set Skip to true when it is not possible to load the missing key for some reason.
UnknownKeyReceived Event (SSHClient Module)
Signals that the server has introduced itself with an unknown key.
Syntax
func onUnknownKeyReceived(algorithm: String, bits: Int32, fingerprintSHA256: String, action: inout Int32)
- (void)onUnknownKeyReceived:(NSString*)algorithm :(int)bits :(NSString*)fingerprintSHA256 :(int*)action;
Remarks
The class fires this event to tell the application that the server has introduced itself with a key not present in TrustedKeysFile.
The details of the key are provided: Algorithm and Bits specify the key algorithm and the number of bits. FingerprintSHA256 contains the key's fingerprint.
In this event handler, you need to make a decision whether to proceed with the connection. Use Action to tell the class what it should do with the key:
catAcceptOnce | 1 | Accept the key for the current session only. |
catAcceptPermanently | 2 | Accept the key for the current session and store the key to the trusted keys list. |
catReject | 3 | Reject the key and close the connection. |
ExternalCrypto Type
Specifies the parameters of external cryptographic calls.
Remarks
External cryptocalls are used in a Distributed Cryptography (DC) subsystem, which allows the delegation of security operations to the remote agent. For instance, it can be used to compute the signature value on the server, while retaining the client's private key locally.
Fields
asyncDocumentID String |
Specifies an optional document ID for SignAsyncBegin() and SignAsyncEnd() calls. Use this property when working with multi-signature DCAuth requests and responses to uniquely identify documents signed within a larger batch. On the completion stage, this value helps the signing component identify the correct signature in the returned batch of responses. If using batched requests, make sure to set this property to the same value on both pre-signing (SignAsyncBegin) and completion (SignAsyncEnd) stages. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customParams String |
Custom parameters to be passed to the signing service (uninterpreted). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data String |
Additional data to be included in the async state and mirrored back by the requestor |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
externalHashCalculation Bool |
Specifies whether the message hash is to be calculated at the external endpoint. Please note that this mode is not supported by all components. In particular, components operating with larger objects (PDFSigner, CAdESSigner, XAdESSigner) do not support it. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hashAlgorithm String |
Specifies the request's signature hash algorithm.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
keyID String |
The ID of the pre-shared key used for DC request authentication. Asynchronous DCAuth-driven communication requires that parties authenticate each other with a secret pre-shared cryptographic key. This provides extra protection layer for the protocol and diminishes the risk of private key becoming abused by foreign parties. Use this property to provide the pre-shared key identifier, and use to pass the key itself. The same KeyID/KeySecret pair should be used on the DCAuth side for the signing requests to be accepted. Note: The KeyID/KeySecret scheme is very similar to the AuthKey scheme used in various Cloud service providers to authenticate users. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
keySecret String |
The pre-shared key used for DC request authentication. This key must be set and match the key used by the DCAuth counterpart for the scheme to work. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
method AsyncSignMethods |
Specifies the asynchronous signing method. This is typically defined by the DC server capabilities and setup. Available options:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode ExternalCryptoModes |
Specifies the external cryptography mode. Available options:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
publicKeyAlgorithm String |
Provide public key algorithm here if the certificate is not available on the pre-signing stage.
|
Constructors
public init()
Creates a new ExternalCrypto object with default field values.
ProxySettings Type
A container for proxy server settings.
Remarks
This type exposes a collection of properties for tuning up the proxy server configuration.
Fields
address String |
The IP address of the proxy server. |
||||||||||
authentication ProxyAuthTypes |
The authentication type used by the proxy server.
|
||||||||||
password String |
The password to authenticate to the proxy server. |
||||||||||
port Int32 |
The port on the proxy server to connect to. |
||||||||||
proxyType ProxyTypes |
The type of the proxy server. The WebTunnel proxy is also known as HTTPS proxy. Unlike HTTP proxy, HTTPS proxy (WebTunnel) provides end-to-end security.
|
||||||||||
requestHeaders String |
Contains HTTP request headers for WebTunnel and HTTP proxy. |
||||||||||
responseBody String |
Contains the HTTP or HTTPS (WebTunnel) proxy response body. |
||||||||||
responseHeaders String |
Contains response headers received from an HTTP or HTTPS (WebTunnel) proxy server. |
||||||||||
useIPv6 Bool |
Specifies whether IPv6 should be used when connecting through the proxy. |
||||||||||
useProxy Bool |
Enables or disables proxy-driven connection. |
||||||||||
username String |
Specifies the username credential for proxy authentication. |
Constructors
public init()
Creates a new ProxySettings object.
SocketSettings Type
A container for the socket settings.
Remarks
This type is a container for socket-layer parameters.
Fields
dnsMode DNSResolveModes |
Selects the DNS resolver to use: the component's (secure) built-in one, or the one provided by the system.
|
||||||||
dnsPort Int32 |
Specifies the port number to be used for sending queries to the DNS server. |
||||||||
dnsQueryTimeout Int32 |
The timeout (in milliseconds) for each DNS query. The value of 0 indicates the infinite timeout. |
||||||||
dnsServers String |
The addresses of DNS servers to use for address resolution, separated by commas or semicolons. |
||||||||
dnsTotalTimeout Int32 |
The timeout (in milliseconds) for the whole resolution process. The value of 0 indicates the infinite timeout. |
||||||||
incomingSpeedLimit Int32 |
The maximum number of bytes to read from the socket, per second. |
||||||||
localAddress String |
The local network interface to bind the socket to. |
||||||||
localPort Int32 |
The local port number to bind the socket to. |
||||||||
outgoingSpeedLimit Int32 |
The maximum number of bytes to write to the socket, per second. |
||||||||
timeout Int32 |
The maximum period of waiting, in milliseconds, after which the socket operation is considered unsuccessful. If Timeout is set to 0, a socket operation will expire after the system-default timeout (2 hrs 8 min for TCP stack). |
||||||||
useIPv6 Bool |
Enables or disables IP protocol version 6. |
Constructors
public init()
Creates a new SocketSettings object.
SSHInfo Type
Contains information about SSH connection.
Remarks
SSHInfo object contains information about one SSH connection.
Fields
clientKeyAlgorithm String |
Specifies the client's key algorithm. |
clientKeyBits Int32 |
Specifies the length of the client's key. |
clientKeyFingerprint String |
The fingerprint (hash value) of the client's public key. |
closeReason String |
Contains the line sent by the server just before closing the connection. It might contain the error description if the connection was not closed gracefully. |
compressionAlgorithmInbound String |
Compression algorithm for the incoming traffic. |
compressionAlgorithmOutbound String |
Compression algorithm for the outgoing traffic. |
encryptionAlgorithmInbound String |
Encryption algorithm for the incoming traffic. |
encryptionAlgorithmOutbound String |
Encryption algorithm for the outgoing traffic. |
inboundEncryptionKeyBits Int32 |
Specifies the length of the key used to encrypt the incoming traffic. |
kexAlgorithm String |
The key exchange algorithm used during the SSH handshake. |
kexBits Int32 |
The number of bits used by the key exchange algorithm. |
kexLines String |
The contents of the received KexInit packet. KexInit packet contains the list of algorithms supported by the remote party. |
macAlgorithmInbound String |
MAC algorithm used for the incoming connection. |
macAlgorithmOutbound String |
MAC algorithm used for outbound connection. |
outboundEncryptionKeyBits Int32 |
Specifies the length of the key used to encrypt the outgoing traffic. |
publicKeyAlgorithm String |
Specifies the public key algorithm which was used during the SSH handshake. |
serverKeyBits Int32 |
Specifies the number of bits in the server's key. |
serverKeyFingerprint String |
The fingerprint (hash value) of the server's public key. |
serverSoftwareName String |
Returns the name of the SSH software running on the server side. |
totalBytesReceived Int64 |
Returns the total number of bytes received over this connection. |
totalBytesSent Int64 |
Returns the total number of bytes sent over this connection. |
version Int32 |
Specifies SSH protocol version. |
Constructors
public init()
Creates an empty object representing a SSH connection info.
SSHKey Type
SSHKey is used to store information about single compound public-key algorithm (such as RSA or DSA) key.
Remarks
SSH keys are used to secure the SSH protocol flow. They support different algorithms and key lengths, a very typical example being RSA-2048 bits.
Fields
algorithm String |
Specifies the key algorithm. |
||||||||||||||||||||||||||||||
bits Int32 |
The number of bits in the key: the more the better, 2048 or 4096 are typical values. |
||||||||||||||||||||||||||||||
comment String |
The comment for the public key. |
||||||||||||||||||||||||||||||
curve String |
Specifies the elliptical curve when EC cryptography is used. |
||||||||||||||||||||||||||||||
dssg Data |
The G (Generator) parameter of the DSS signature key. The string should contain the binary data of G. |
||||||||||||||||||||||||||||||
dssp Data |
The P (Prime) parameter of the DSS signature key. The string should contain the binary data of P. |
||||||||||||||||||||||||||||||
dssq Data |
The Q (Prime Factor) parameter of the DSS signature key. The string should contain the binary data of Q. |
||||||||||||||||||||||||||||||
dssx Data |
The X (Private key) parameter of the DSS signature key. The string should contain the binary data of X. This parameter may be empty if there's no need to sign data with this key (e.g. if the key is a server public key needed only to authenticate the server). |
||||||||||||||||||||||||||||||
dssy Data |
The Y (Public key) parameter of the DSS signature key. The string should contain the binary data of Y. |
||||||||||||||||||||||||||||||
eccd Data |
The value of the secret key (the order of the public key, D) if elliptic curve (EC) cryptography is used. The string should contain the binary data of D. |
||||||||||||||||||||||||||||||
eccqx Data |
The value of the X coordinate of the public key if elliptic curve (EC) cryptography is used. The string should contain the binary data of X. |
||||||||||||||||||||||||||||||
eccqy Data |
The value of the Y coordinate of the public key if elliptic curve (EC) cryptography is used. The string should contain the binary data of Y. |
||||||||||||||||||||||||||||||
edPrivate Data |
The value of the private key if EdDSA (Edwards-curve Digital Signature Algorithm) algorithm is used. |
||||||||||||||||||||||||||||||
edPublic Data |
The value of the public key if EdDSA (Edwards-curve Digital Signature Algorithm) algorithm is used. |
||||||||||||||||||||||||||||||
fingerprintMD5 String |
Contains the MD5 fingerprint (hash) of the key. |
||||||||||||||||||||||||||||||
fingerprintSHA1 String |
Contains the SHA-1 fingerprint (hash) of the key. |
||||||||||||||||||||||||||||||
fingerprintSHA256 String |
Contains the SHA-256 fingerprint (hash) of the key. |
||||||||||||||||||||||||||||||
handle Int64 |
Allows to get or set a 'handle', a unique identifier of the underlying property object. Use this property to assign objects of the same type in a quicker manner, without copying them fieldwise. When you pass a handle of one object to another, the source object is copied to the destination rather than assigned. It is safe to get rid of the original object
after such operation.
|
||||||||||||||||||||||||||||||
isExtractable Bool |
Whether the key is extractable (e.g., from a security token), or not. |
||||||||||||||||||||||||||||||
isPrivate Bool |
Whether this key is a private key or not. |
||||||||||||||||||||||||||||||
isPublic Bool |
Whether this key is a public key or not. |
||||||||||||||||||||||||||||||
kdfRounds Int32 |
Returns the number of iterations of the Key Derivation Function (KDF) used to generate this key. |
||||||||||||||||||||||||||||||
kdfSalt Data |
The salt value used by the Key Derivation Function (KDF) to generate this key. |
||||||||||||||||||||||||||||||
keyFormat SSHKeyFormats |
Specifies the format in which the key is stored.
|
||||||||||||||||||||||||||||||
keyProtectionAlgorithm String |
Specifies the key protection algorithm. |
||||||||||||||||||||||||||||||
rsaExponent Data |
Returns the e parameter (public exponent) of the RSA key. |
||||||||||||||||||||||||||||||
rsaiqmp Data |
Returns the iqmp parameter of the RSA key. |
||||||||||||||||||||||||||||||
rsaModulus Data |
Returns the m parameter (public modulus) of the RSA key. |
||||||||||||||||||||||||||||||
rsap Data |
Returns the p parameter (first factor of the common modulus n) of the RSA key. |
||||||||||||||||||||||||||||||
rsaPrivateExponent Data |
Returns the d parameter (private exponent) of the RSA key. |
||||||||||||||||||||||||||||||
rsaq Data |
Returns the q parameter (second factor of the common modulus n) of the RSA key. |
||||||||||||||||||||||||||||||
subject String |
Specifies the public key owner (subject). This property is used only for IETF-keys. |
Constructors
public init()
Creates a new key.
SSHSettings Type
A container for various SSH protocol settings.
Remarks
SSHSettings stores various settings of SSH client or server.
Fields
autoAdjustCiphers Bool |
Whether the SSH client should adjust its list of supported ciphers 'on-the-fly' for greater compatibility with the server it is connecting to. |
baseConfiguration SecureTransportPredefinedConfigurations |
Allows to choose base configuration of SSH settings, tuned up for different purposes such as high security or higher compatibility. |
compressionAlgorithms String |
A list of session compression algorithms separated with commas or semicolons. Each algorithm in the list may be prefixed with a minus sign (-) to indicate that the algorithm should be disabled rather than enabled. Besides the specific algorithm names, this property supports the all (and -all) aliases that allow to blanketly enable or disable all compression algorithms at once. Note: the list of algorithms provided to this property alters the baseline list of compression algorithms pre-configured for this component. Remember to start your algorithm string with -all; if you need to only enable a specific fixed set of algorithms. The list of supported compression algorithms is provided below:
|
compressionLevel Int32 |
Possible values for the Compression Level range from 0 (minimum compression) to 9 (maximum compression). This setting is ignored if compression wasn't accepted. |
defaultWindowSize Int32 |
The SSH window size specifies how many bytes the client can send to the server in the command channel without obtaining pre-authorization for the further send from the server. |
encryptionAlgorithms String |
A list of session encryption algorithms separated with commas or semicolons. Each algorithm in the list may be prefixed with a minus sign (-) to indicate that the algorithm should be disabled rather than enabled. Besides the specific algorithm names, this property supports the all (and -all) aliases that allow to blanketly enable or disable all encryption algorithms at once. Note: the list of algorithms provided to this property alters the baseline list of encryption algorithms pre-configured for this component. Remember to start your algorithm string with -all; if you need to only enable a specific fixed set of algorithms. The list of supported encryption algorithms is provided below:
|
forceCompression Bool |
Whether the SSH client should explicitly request compression. If ForceCompression is False, compression will be used only if the server doesn't support algorithms without compression. |
gssAuthTypes String |
A comma-separated list of authentication types. Two types are currently supported: gssapi-with-mic and gssapi-keyex. |
gssDelegateCreds Bool |
Switches credential delegation on or off. |
gssHostname String |
The GSS host name, in form of a FQDN (e.g. hostname.com), a principal name (e.g. 'host@hostname.com), or a cross-real ticket-granting ticket (e.g. krbtgt/test.com@example.com). |
gssLib String |
A path to the GSS-API library (DLL or SO). |
gssMechanisms String |
A comma-separated list of GSS mechanisms to use. Two values are currently supported: lib and SSPI. |
gssProtocols String |
A comma-separated list of SSPI protocols. Two protocols are currently supported: kerberos and NTLM. |
handshakeTimeout Int32 |
Specifies the maximal time for the SSH handshake to proceed, in seconds. If the handshake is not completed within this period, the session is aborted. |
kexAlgorithms String |
A list of key exchange algorithms separated with commas or semicolons. Each algorithm in the list may be prefixed with a minus sign (-) to indicate that the algorithm should be disabled rather than enabled. Besides the specific algorithm names, this property supports the all (and -all) aliases that allow to blanketly enable or disable all key exchange algorithms at once. Note: the list of algorithms provided to this property alters the baseline list of key exchange algorithms pre-configured for this component. Remember to start your algorithm string with -all; if you need to only enable a specific fixed set of algorithms. The list of supported kex algorithms is provided below:
|
macAlgorithms String |
A list of MAC (for message authentication code) algorithms separated with commas or semicolons. Each algorithm in the list may be prefixed with a minus sign (-) to indicate that the algorithm should be disabled rather than enabled. Besides the specific algorithm names, this property supports the all (and -all) aliases that allow to blanketly enable or disable all MAC algorithms at once. Note: the list of algorithms provided to this property alters the baseline list of MAC algorithms pre-configured for this component. Remember to start your algorithm string with -all; if you need to only enable a specific fixed set of algorithms. The list of supported MAC algorithms is provided below:
|
maxSSHPacketSize Int32 |
Specifies the maximum length of one SSH packet in bytes. |
minWindowSize Int32 |
Specifies the minimal internal window size. When the minimal window size is reached, the 'window extension' request is sent to the server. This request notifies the server that the window was extended, and it can send more data. |
obfuscateHandshake Bool |
Enables or disables handshake obfuscation. |
obfuscationPassword String |
Specifies the password used to encrypt the handshake when ObfuscateHandshake is set. |
publicKeyAlgorithms String |
A list of public key algorithms separated with commas or semicolons. Each algorithm in the list may be prefixed with a minus sign (-) to indicate that the algorithm should be disabled rather than enabled. Besides the specific algorithm names, this property supports the all (and -all) aliases that allow to blanketly enable or disable all public key algorithms at once. Note: the list of algorithms provided to this property alters the baseline list of public key algorithms pre-configured for this component. Remember to start your algorithm string with -all; if you need to only enable a specific fixed set of algorithms. The list of supported public key algorithms is provided below:
|
requestPasswordChange Bool |
Whether to request a password change when connecting. |
softwareName String |
The name to be used by the component to identify itself. |
trustAllKeys Bool |
Enables or disables explicit trust to all server keys. Use with care. |
useAuthAgent Bool |
Enables or disables the use of external key agent, such as Putty key agent. |
versions Int32 |
Specifies enabled SSH protocol versions (1 or 2). |
Constructors
public init()
Creates a new object with default settings.
SSHTerm Type
A container for SSH terminal settings.
Remarks
SSHTerm stores terminal settings of the SSH client.
Fields
cols Int32 |
Specifies the width of the pseudoterminal, in characters. |
environment String |
Specifies the list of environment variables. |
eolChar Data |
Specifies the End-of-Line character or sequence. |
height Int32 |
Specifies the height of the pseudoterminal, in pixels. |
opcodes String |
Specifies the operation codes specific for the terminal. |
protocol_ String |
The terminal protocol name. |
requestPty Bool |
Specifies whether to request a pseudoterminal for the session. |
rows Int32 |
Specifies the height of the pseudoterminal, in lines. |
width Int32 |
Specifies the width of the pseudoterminal, in pixels. |
Config Settings (SSHClient Module)
The class accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.SSHClient Config Settings | ||||||||||||||||||||||||||||||
BlockSize: The data block size.This property specifies the data block size to use. | ||||||||||||||||||||||||||||||
ErrorOrigin: Specifies whether the error is local or remote.Use this property to check where the error took place. | ||||||||||||||||||||||||||||||
ErrorSeverity: Specifies whether the error is fatal.Use this property to check whether the error is fatal or not. | ||||||||||||||||||||||||||||||
LocalCharset: Charset used on the client machine.This property specifies the charset used on the local client computer. | ||||||||||||||||||||||||||||||
RemoteCharset: Charset used on the server.This property specifies the charset used on the server. | ||||||||||||||||||||||||||||||
SendCommandEOF: Defines whether EOF control character should be sent after the command data.Enable this property to enforce sending of a trailing EOF character after the command data. | ||||||||||||||||||||||||||||||
ThrottleControl: Enables or disables throttle control for the connection.Use this property to enable or disable throttle control. | ||||||||||||||||||||||||||||||
Base Config Settings | ||||||||||||||||||||||||||||||
CheckKeyIntegrityBeforeUse:
Enables or disable private key integrity check before use.This global property enables or disables private key material check before each signing operation. This slows down performance a bit,
but prevents a selection of attacks on RSA keys where keys with unknown origins are used.
You can switch this property off to improve performance if your project only uses known, good private keys. |
||||||||||||||||||||||||||||||
CookieCaching:
Specifies whether a cookie cache should be used for HTTP(S) transports.Set this property to enable or disable cookies caching for the class.
Supported values are:
|
||||||||||||||||||||||||||||||
Cookies: Gets or sets local cookies for the class (supported for HTTPClient, RESTClient and SOAPClient only).Use this property to get cookies from the internal cookie storage of the class and/or restore them back between application sessions. | ||||||||||||||||||||||||||||||
DefDeriveKeyIterations: Specifies the default key derivation algorithm iteration count.This global property sets the default number of iterations for all supported key derivation algorithms. Note that you can provide the required number of iterations by using properties of the relevant key generation component; this global setting is used in scenarios where specific iteration count is not or cannot be provided. | ||||||||||||||||||||||||||||||
EnableClientSideSSLFFDHE:
Enables or disables finite field DHE key exchange support in TLS clients.This global property enables or disables support for finite field DHE key exchange methods in TLS clients. FF DHE is a slower
algorithm if compared to EC DHE; enabling it may result in slower connections.
This setting only applies to sessions negotiated with TLS version 1.3. |
||||||||||||||||||||||||||||||
GlobalCookies: Gets or sets global cookies for all the HTTP transports.Use this property to get cookies from the GLOBAL cookie storage or restore them back between application sessions. These cookies will be used by all the classes that have its CookieCaching property set to "global". | ||||||||||||||||||||||||||||||
HttpUserAgent: Specifies the user agent name to be used by all HTTP clients.This global setting defines the User-Agent field of the HTTP request provides information about the software that initiates the request. This value will be used by all the HTTP clients including the ones used internally in other classes. | ||||||||||||||||||||||||||||||
LogDestination:
Specifies the debug log destination.Contains a comma-separated list of values that specifies where debug log should be dumped.
Supported values are:
|
||||||||||||||||||||||||||||||
LogDetails:
Specifies the debug log details to dump.Contains a comma-separated list of values that specifies which debug log details to dump.
Supported values are:
|
||||||||||||||||||||||||||||||
LogFile: Specifies the debug log filename.Use this property to provide a path to the log file. | ||||||||||||||||||||||||||||||
LogFilters:
Specifies the debug log filters.Contains a comma-separated list of value pairs ("name:value") that describe filters.
Supported filter names are:
|
||||||||||||||||||||||||||||||
LogFlushMode:
Specifies the log flush mode.Use this property to set the log flush mode. The following values are defined:
|
||||||||||||||||||||||||||||||
LogLevel:
Specifies the debug log level.Use this property to provide the desired debug log level.
Supported values are:
|
||||||||||||||||||||||||||||||
LogMaxEventCount:
Specifies the maximum number of events to cache before further action is taken.Use this property to specify the log event number threshold. This threshold may have different effects,
depending on the rotation setting and/or the flush mode.
The default value of this setting is 100. |
||||||||||||||||||||||||||||||
LogRotationMode:
Specifies the log rotation mode.Use this property to set the log rotation mode. The following values are defined:
|
||||||||||||||||||||||||||||||
MaxASN1BufferLength: Specifies the maximal allowed length for ASN.1 primitive tag data.This global property limits the maximal allowed length for ASN.1 tag data for non-content-carrying structures, such as certificates, CRLs, or timestamps. It does not affect structures that can carry content, such as CMS/CAdES messages. This is a security property aiming at preventing DoS attacks. | ||||||||||||||||||||||||||||||
MaxASN1TreeDepth: Specifies the maximal depth for processed ASN.1 trees.This global property limits the maximal depth of ASN.1 trees that the component can handle without throwing an error. This is a security property aiming at preventing DoS attacks. | ||||||||||||||||||||||||||||||
OCSPHashAlgorithm: Specifies the hash algorithm to be used to identify certificates in OCSP requests.This global setting defines the hash algorithm to use in OCSP requests during chain validation. Some OCSP responders can only use older algorithms, in which case setting this property to SHA1 may be helpful. | ||||||||||||||||||||||||||||||
StaticDNS:
Specifies whether static DNS rules should be used.Set this property to enable or disable static DNS rules for the class. Works only if UseOwnDNSResolver is set to true.
Supported values are:
|
||||||||||||||||||||||||||||||
StaticIPAddress[domain]: Gets or sets an IP address for the specified domain name.Use this property to get or set an IP address for the specified domain name in the internal (of the class) or global DNS rules storage depending on the StaticDNS value. The type of the IP address (IPv4 or IPv6) is determined automatically. If both addresses are available, they are devided by the | (pipe) character. | ||||||||||||||||||||||||||||||
StaticIPAddresses: Gets or sets all the static DNS rules.Use this property to get static DNS rules from the current rules storage or restore them back between application sessions. If StaticDNS of the class is set to "local", the property returns/restores the rules from/to the internal storage of the class. If StaticDNS of the class is set to "global", the property returns/restores the rules from/to the GLOBAL storage. The rules list is returned and accepted in JSON format. | ||||||||||||||||||||||||||||||
Tag: Allows to store any custom data.Use this config property to store any custom data. | ||||||||||||||||||||||||||||||
UseOwnDNSResolver: Specifies whether the client components should use own DNS resolver.Set this global property to false to force all the client components to use the DNS resolver provided by the target OS instead of using own one. | ||||||||||||||||||||||||||||||
UseSharedSystemStorages: Specifies whether the validation engine should use a global per-process copy of the system certificate stores.Set this global property to false to make each validation run use its own copy of system certificate stores. | ||||||||||||||||||||||||||||||
UseSystemOAEPAndPSS:
Enforces or disables the use of system-driven RSA OAEP and PSS computations.This global setting defines who is responsible for performing RSA-OAEP and RSA-PSS computations where the private key is stored in a Windows system store and is exportable.
If set to true, SBB will delegate the computations to Windows via a CryptoAPI call. Otherwise, it will export the key material and perform the computations
using its own OAEP/PSS implementation.
This setting only applies to certificates originating from a Windows system store. |
||||||||||||||||||||||||||||||
UseSystemRandom: Enables or disables the use of the OS PRNG.Use this global property to enable or disable the use of operating system-driven pseudorandom number generation. |