# SFTPServer Class

The SFTPServer class provides server-side functionality for SFTP connections.

## Syntax

```text
secureblackbox.SFTPServer
```

## Remarks

SFTPServer is an implementation for SSH File Transfer Protocol server. It works over a secure SSH channel, and should not be confused with the FTP/FTPS protocol.

## Property List

*The following is the full list of the properties of the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Active](#active-property-sftpserver-class) | Specifies whether the SFTP server has started and ready to accept connections. |
| [AuthTypes](#authtypes-property-sftpserver-class) | Defines allowed authentication types. |
| [BaseDir](#basedir-property-sftpserver-class) | Specifies the server's base (root) directory. |
| [Capabilities](#capabilities-property-sftpserver-class) | Specifies which elements of the SSH ecosystem the class must support/enable. |
| [ClientFileEntry](#clientfileentry-property-sftpserver-class) | A container for file entry details. |
| [ClientKey](#clientkey-property-sftpserver-class) | Contains client's public key. |
| [CompressionLevel](#compressionlevel-property-sftpserver-class) | Specifies the preferable compression level. |
| [ExternalCrypto](#externalcrypto-property-sftpserver-class) | Provides access to external signing and DC parameters. |
| [FIPSMode](#fipsmode-property-sftpserver-class) | Reserved. |
| [ForceCompression](#forcecompression-property-sftpserver-class) | This property specifies whether server explicitly requires data compression. |
| [Host](#host-property-sftpserver-class) | Specifies server's host name. |
| [MaxSFTPVersion](#maxsftpversion-property-sftpserver-class) | Maximum SFTP version supported. |
| [MinSFTPVersion](#minsftpversion-property-sftpserver-class) | Minimum SFTP version supported. |
| [PinnedClient](#pinnedclient-property-sftpserver-class) | Populates the pinned client details. |
| [Port](#port-property-sftpserver-class) | Specifies the listening port number. |
| [ReadOnly](#readonly-property-sftpserver-class) | Specifies whether files on the server are read-only. |
| [ServerKeys](#serverkeys-property-sftpserver-class) | The server's SSH keys. |
| [SocketSettings](#socketsettings-property-sftpserver-class) | Manages network connection settings. |
| [SSHSettings](#sshsettings-property-sftpserver-class) | The SSH connection settings. |
| [Users](#users-property-sftpserver-class) | A collection of known users. |
| [UseUTF8](#useutf8-property-sftpserver-class) | Specifies whether UTF8 conversion is to be used when parsing file names. |

## Method List

*The following is the full list of the methods of the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Cleanup](#cleanup-method-sftpserver-class) | Cleans up the server environment by purging expired sessions and cleaning caches. |
| [Config](#config-method-sftpserver-class) | Sets or retrieves a configuration setting. |
| [DoAction](#doaction-method-sftpserver-class) | Performs an additional action. |
| [DropClient](#dropclient-method-sftpserver-class) | Terminates a client connection. |
| [GetClientBuffer](#getclientbuffer-method-sftpserver-class) | Acquires a piece of operation data. |
| [GetClientFileEntry](#getclientfileentry-method-sftpserver-class) | Acquires file entry details from the class. |
| [ListClients](#listclients-method-sftpserver-class) | Enumerates the connected clients. |
| [PinClient](#pinclient-method-sftpserver-class) | Takes a snapshot of the connection's properties. |
| [Reset](#reset-method-sftpserver-class) | Resets the class settings. |
| [SetClientBuffer](#setclientbuffer-method-sftpserver-class) | Commits a data buffer to the server class. |
| [SetClientFileEntry](#setclientfileentry-method-sftpserver-class) | Commits the file entry details to the class. |
| [Start](#start-method-sftpserver-class) | Starts SFTP server operation. |
| [Stop](#stop-method-sftpserver-class) | Stops SFTP server. |

## Event List

*The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Accept](#accept-event-sftpserver-class) | This event is fired when new incoming connection is accepted. |
| [AfterCreateDirectory](#aftercreatedirectory-event-sftpserver-class) | This event indicates completion of directory creation request. |
| [AfterRemove](#afterremove-event-sftpserver-class) | This event indicates completion of file removal request. |
| [AfterRenameFile](#afterrenamefile-event-sftpserver-class) | This event indicates completion of a file rename operation. |
| [AfterRequestAttributes](#afterrequestattributes-event-sftpserver-class) | This event indicates completion of file attributes request. |
| [AfterSetAttributes](#aftersetattributes-event-sftpserver-class) | This event indicates completion of a set attributes request. |
| [AuthAttempt](#authattempt-event-sftpserver-class) | Reports a user authentication attempt. |
| [AuthFailed](#authfailed-event-sftpserver-class) | Reports user authentication failure. |
| [AuthPassword](#authpassword-event-sftpserver-class) | This event is fired on password authentication attempt from a client. |
| [AuthPublicKey](#authpublickey-event-sftpserver-class) | This event is fired on public key authentication attempt from a client. |
| [AuthSucceeded](#authsucceeded-event-sftpserver-class) | Reports a successful user authentication. |
| [BeforeCreateDirectory](#beforecreatedirectory-event-sftpserver-class) | This event is fired when a client requests to create a directory. |
| [BeforeDownloadFile](#beforedownloadfile-event-sftpserver-class) | This event is fired when a download file request is received. |
| [BeforeFind](#beforefind-event-sftpserver-class) | This event is fired when a client requests to find files and folders in Path. |
| [BeforeOpenClientForwarding](#beforeopenclientforwarding-event-sftpserver-class) | This event is fired when a client requests to set up client-side (local) forwarding channel. |
| [BeforeOpenCommand](#beforeopencommand-event-sftpserver-class) | This event is fired when a client requests a command channel. |
| [BeforeOpenServerForwarding](#beforeopenserverforwarding-event-sftpserver-class) | This event is fired when the server has received an incoming connection and needs to set up server-side (remote) forwarding channel. |
| [BeforeOpenShell](#beforeopenshell-event-sftpserver-class) | This event is fired when a client requests a shell channel. |
| [BeforeRemove](#beforeremove-event-sftpserver-class) | This event is fired when a client requests to delete a file or directory. |
| [BeforeRenameFile](#beforerenamefile-event-sftpserver-class) | This event is fired when a client requests to rename a file. |
| [BeforeRequestAttributes](#beforerequestattributes-event-sftpserver-class) | This event is fired when a client requests to get file attributes. |
| [BeforeSetAttributes](#beforesetattributes-event-sftpserver-class) | This event is fired when a client requests to set file attributes. |
| [BeforeUploadFile](#beforeuploadfile-event-sftpserver-class) | This event is fired when an upload file request is received. |
| [CloseClientForwarding](#closeclientforwarding-event-sftpserver-class) | This event is fired when a client has closed a previously opened forwarding channel. |
| [CloseCommand](#closecommand-event-sftpserver-class) | This event is fired when a client has closed a previously opened SSH command channel. |
| [CloseFile](#closefile-event-sftpserver-class) | This event instructs the application to close an opened file. |
| [CloseServerForwarding](#closeserverforwarding-event-sftpserver-class) | This event is fired when a client has closed a previously opened forwarding channel. |
| [CloseShell](#closeshell-event-sftpserver-class) | This event is fired when a client has closed a previously opened shell channel. |
| [Connect](#connect-event-sftpserver-class) | This event is fired when a remote connection has been established. |
| [CreateDirectory](#createdirectory-event-sftpserver-class) | This event instructs the application to create a directory. |
| [Disconnect](#disconnect-event-sftpserver-class) | This event is fired when a client has disconnected. |
| [Error](#error-event-sftpserver-class) | Information about errors during data delivery. |
| [ExternalSign](#externalsign-event-sftpserver-class) | Handles remote or external signing initiated by the server protocol. |
| [FindClose](#findclose-event-sftpserver-class) | This event signifies the completion of a custom file listing operation. |
| [FindFirst](#findfirst-event-sftpserver-class) | This event signifies the start of the custom file listing retrieval mechanism. |
| [FindNext](#findnext-event-sftpserver-class) | This event retrieves the next entry of a custom file listing. |
| [ListeningStarted](#listeningstarted-event-sftpserver-class) | Fires when the server has started accepting connections on a local port. |
| [ListeningStopped](#listeningstopped-event-sftpserver-class) | Fires when the server has stopped accepting connections on a local port. |
| [Notification](#notification-event-sftpserver-class) | This event notifies the application about an underlying control flow event. |
| [OpenClientForwarding](#openclientforwarding-event-sftpserver-class) | This event is fired when a client opens a client-side (local) forwarding channel. |
| [OpenCommand](#opencommand-event-sftpserver-class) | This event is fired when a client has opened an SSH command channel. |
| [OpenFile](#openfile-event-sftpserver-class) | This event instructs the application to handle the file open request. |
| [OpenServerForwarding](#openserverforwarding-event-sftpserver-class) | This event is fired when the server opens a server-side (remote) forwarding channel. |
| [OpenShell](#openshell-event-sftpserver-class) | This event is fired when a client has opened a shell channel. |
| [ReadFile](#readfile-event-sftpserver-class) | This event is fired when a file read request is received. |
| [Remove](#remove-event-sftpserver-class) | This event is fired when a client requests to delete a file or directory. |
| [RenameFile](#renamefile-event-sftpserver-class) | This event is fired when a client requests to rename a file. |
| [RequestAttributes](#requestattributes-event-sftpserver-class) | This event is fired when a get file attributes request is received. |
| [ServerForwardingCancel](#serverforwardingcancel-event-sftpserver-class) | This event is fired when the client cancels a previously negotiated server-side (remote) forwarding. |
| [ServerForwardingOpenFailed](#serverforwardingopenfailed-event-sftpserver-class) | This event is fired when the client rejects the server request to establish a server forwarding channel. |
| [ServerForwardingRequest](#serverforwardingrequest-event-sftpserver-class) | This event is fired when the client requests the server to set up server-side (remote) forwarding. |
| [SessionClosed](#sessionclosed-event-sftpserver-class) | Reports session closure. |
| [SessionEstablished](#sessionestablished-event-sftpserver-class) | This event is fired when a new session is established. |
| [SetAttributes](#setattributes-event-sftpserver-class) | This event is fired when an set file attributes request is received. |
| [TranslatePath](#translatepath-event-sftpserver-class) | This event is fired when a client requests the server to translate a path to its absolute form. |
| [WriteFile](#writefile-event-sftpserver-class) | This event is fired when a file write request is received. |

## Config Settings

*The following is a list of config settings for the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [AllAlgorithms](#AllAlgorithms) | Returns the list of algorithms enabled in the class. |
| [AsyncDataWindowManagement](#AsyncDataWindowManagement) | TBD. |
| [AuthMode](#AuthMode) | Controls dual/multi-type authentication mode. |
| [AutoGenerateLongNames](#AutoGenerateLongNames) | TBD. |
| [Banner\[i\]](#Banner[i]) | TBD. |
| [BannerSendStage](#BannerSendStage) | TBD. |
| [CloseIfNoActiveTunnels](#CloseIfNoActiveTunnels) | TBD. |
| [CommandModeEnabled](#CommandModeEnabled) | TBD. |
| [CompressionAlgorithms](#CompressionAlgorithms) | Returns the list of compression algorithms enabled in the class. |
| [CustomDHGroupIndex](#CustomDHGroupIndex) | Sets a specific Diffie-Hellman group index to enforce. |
| [DefBanner](#DefBanner) | TBD. |
| [DefLanguageTag](#DefLanguageTag) | TBD. |
| [DualStack](#DualStack) | Allows the use of ip4 and ip6 simultaneously. |
| [EncryptionAlgorithms](#EncryptionAlgorithms) | Returns the list of encryption algorithms enabled in the class. |
| [KexAlgorithms](#KexAlgorithms) | Returns the list of key exchange algorithms enabled in the class. |
| [LanguageTag\[i\]](#LanguageTag[i]) | TBD. |
| [MacAlgorithms](#MacAlgorithms) | Returns the list of MAC algorithms enabled in the class. |
| [MaxDHGroupSize](#MaxDHGroupSize) | Sets the maximal Diffie-Hellman group size. |
| [MinDHGroupSize](#MinDHGroupSize) | Sets the minimal Diffie-Hellman group size. |
| [NotifyOnFileOperations](#NotifyOnFileOperations) | Enables low-level file operation notifications. |
| [PublicKeyAlgorithms](#PublicKeyAlgorithms) | Returns the list of public key algorithms enabled in the class. |
| [RefreshUsers](#RefreshUsers) | Enables or disables real-time propagation of user information. |
| [SFTPModeEnabled](#SFTPModeEnabled) | TBD. |
| [ShellModeEnabled](#ShellModeEnabled) | TBD. |
| [UseStrictKeyExchange](#UseStrictKeyExchange) | Specifies how strict key exchange is supported. |
| [ASN1UseGlobalTagCache](#ASN1UseGlobalTagCache) | Controls whether ASN.1 module should use a global object cache. |
| [AssignSystemSmartCardPins](#AssignSystemSmartCardPins) | Specifies whether CSP-level PINs should be assigned to CNG keys. |
| [CheckKeyIntegrityBeforeUse](#CheckKeyIntegrityBeforeUse) | Enables or disable private key integrity check before use. |
| [CookieCaching](#CookieCaching) | Specifies whether a cookie cache should be used for HTTP(S) transports. |
| [Cookies](#Cookies) | Gets or sets local cookies for the class. |
| [DefDeriveKeyIterations](#DefDeriveKeyIterations) | Specifies the default key derivation algorithm iteration count. |
| [DNSLocalSuffix](#DNSLocalSuffix) | The suffix to assign for TLD names. |
| [EnableClientSideSSLFFDHE](#EnableClientSideSSLFFDHE) | Enables or disables finite field DHE key exchange support in TLS clients. |
| [EnableSSHMLKEM](#EnableSSHMLKEM) | Enables support for ML-KEM/hybrid key exchange algorithms in SSH client and server classes. |
| [EnableTLSMLKEM](#EnableTLSMLKEM) | Enables support for ML-KEM and hybrid groups in TLS client and server classes. |
| [GlobalCookies](#GlobalCookies) | Gets or sets global cookies for all the HTTP transports. |
| [HardwareCryptoUsePolicy](#HardwareCryptoUsePolicy) | The hardware crypto usage policy. |
| [HttpUserAgent](#HttpUserAgent) | Specifies the user agent name to be used by all HTTP clients. |
| [HttpVersion](#HttpVersion) | The HTTP version to use in any inner HTTP client classes created. |
| [IgnoreExpiredMSCTLSigningCert](#IgnoreExpiredMSCTLSigningCert) | Whether to tolerate the expired Windows Update signing certificate. |
| [ListDelimiter](#ListDelimiter) | The delimiter character for multi-element lists. |
| [LogDestination](#LogDestination) | Specifies the debug log destination. |
| [LogDetails](#LogDetails) | Specifies the debug log details to dump. |
| [LogFile](#LogFile) | Specifies the debug log filename. |
| [LogFilters](#LogFilters) | Specifies the debug log filters. |
| [LogFlushMode](#LogFlushMode) | Specifies the log flush mode. |
| [LogLevel](#LogLevel) | Specifies the debug log level. |
| [LogMaxEventCount](#LogMaxEventCount) | Specifies the maximum number of events to cache before further action is taken. |
| [LogRotationMode](#LogRotationMode) | Specifies the log rotation mode. |
| [MaxASN1BufferLength](#MaxASN1BufferLength) | Specifies the maximal allowed length for ASN.1 primitive tag data. |
| [MaxASN1TreeDepth](#MaxASN1TreeDepth) | Specifies the maximal depth for processed ASN.1 trees. |
| [OCSPHashAlgorithm](#OCSPHashAlgorithm) | Specifies the hash algorithm to be used to identify certificates in OCSP requests. |
| [OldClientSideRSAFallback](#OldClientSideRSAFallback) | Specifies whether the SSH client should use a SHA1 fallback. |
| [PKICache](#PKICache) | Specifies which PKI elements (certificates, CRLs, OCSP responses) should be cached. |
| [PKICachePath](#PKICachePath) | Specifies the file system path where cached PKI data is stored. |
| [ProductVersion](#ProductVersion) | Returns the version of the SecureBlackbox library. |
| [ServerSSLDHKeyLength](#ServerSSLDHKeyLength) | Sets the size of the TLS DHE key exchange group. |
| [StaticDNS](#StaticDNS) | Specifies whether static DNS rules should be used. |
| [StaticIPAddress\[domain\]](#StaticIPAddress[domain]) | Gets or sets an IP address for the specified domain name. |
| [StaticIPAddresses](#StaticIPAddresses) | Gets or sets all the static DNS rules. |
| [Tag](#Tag) | Allows to store any custom data. |
| [TLSSessionGroup](#TLSSessionGroup) | Specifies the group name of TLS sessions to be used for session resumption. |
| [TLSSessionLifetime](#TLSSessionLifetime) | Specifies lifetime in seconds of the cached TLS session. |
| [TLSSessionPurgeInterval](#TLSSessionPurgeInterval) | Specifies how often the session cache should remove the expired TLS sessions. |
| [UseCRLObjectCaching](#UseCRLObjectCaching) | Specifies whether reuse of loaded CRL objects is enabled. |
| [UseInternalRandom](#UseInternalRandom) | Switches between SecureBlackbox-own and platform PRNGs. |
| [UseLegacyAdESValidation](#UseLegacyAdESValidation) | Enables legacy AdES validation mode. |
| [UseOCSPResponseObjectCaching](#UseOCSPResponseObjectCaching) | Specifies whether reuse of loaded OCSP response objects is enabled. |
| [UseOwnDNSResolver](#UseOwnDNSResolver) | Specifies whether the client classes should use own DNS resolver. |
| [UseSharedSystemStorages](#UseSharedSystemStorages) | Specifies whether the validation engine should use a global per-process copy of the system certificate stores. |
| [UseSystemNativeSizeCalculation](#UseSystemNativeSizeCalculation) | An internal CryptoAPI access tweak. |
| [UseSystemOAEPAndPSS](#UseSystemOAEPAndPSS) | Enforces or disables the use of system-driven RSA OAEP and PSS computations. |
| [UseSystemRandom](#UseSystemRandom) | Enables or disables the use of the OS PRNG. |
| [XMLRDNDescriptorName\[OID\]](#XMLRDNDescriptorName[OID]) | Defines an OID mapping to descriptor names for the certificate's IssuerRDN or SubjectRDN. |
| [XMLRDNDescriptorPriority\[OID\]](#XMLRDNDescriptorPriority[OID]) | Specifies the priority of descriptor names associated with a specific OID. |
| [XMLRDNDescriptorReverseOrder](#XMLRDNDescriptorReverseOrder) | Specifies whether to reverse the order of descriptors in RDN. |
| [XMLRDNDescriptorSeparator](#XMLRDNDescriptorSeparator) | Specifies the separator used between descriptors in RDN. |

# Active Property ([SFTPServer](#sftpserver-class) Class)

Specifies whether the SFTP server has started and ready to accept connections.

## Syntax

```text
public boolean isActive();
```

## Default Value

False

## Remarks

Check this property to find out whether the SFTP server is in active mode. Use [Start](#start-method-sftpserver-class) and [Stop](#stop-method-sftpserver-class) methods to activate or deactivate the server.

This property is read-only and not available at design time.

# AuthTypes Property ([SFTPServer](#sftpserver-class) Class)

Defines allowed authentication types.

## Syntax

```text
public int getAuthTypes();
public void setAuthTypes(int authTypes);
```

## Default Value

30

## Remarks

Use this property to define which authentication types are allowed on the server, set of

|  |  |  |
| --- | --- | --- |
| atRhosts | 0x01 | RHOSTS file authentication. Rarely used today. |
| atPublicKey | 0x02 | Public key (sometimes called private key) authentication |
| atPassword | 0x04 | Password-based authentication |
| atHostbased | 0x08 | Hostbased authentication |
| atKeyboard | 0x10 | Keyboard-interactive authentication. This is often used in place of generic password authentication. |
| atGssWithMic | 0x20 | GSS authentication |
| atGssKeyex | 0x40 | GSS authentication with key exchange |
| atPublicKeyAgent | 0x80 | Public key agent authentication |

# BaseDir Property ([SFTPServer](#sftpserver-class) Class)

Specifies the server's base (root) directory.

## Syntax

```text
public String getBaseDir();
public void setBaseDir(String baseDir);
```

## Default Value

""

## Remarks

Use this property to set the base (root) directory on the server.

NOTE: If this property is not specified, it will default to the root of the system drive (C:\ on Windows).

# Capabilities Property ([SFTPServer](#sftpserver-class) Class)

Specifies which elements of the SSH ecosystem the class must support/enable.

## Syntax

```text
public int getCapabilities();
public void setCapabilities(int capabilities);
```

## Default Value

1

## Remarks

Use this property to specify the capabilities of the SSH framework the component must support by adjusting the following bit flags:

|  |  |  |
| --- | --- | --- |
| scSFTP | 0x01 | SFTP (secure file transfer) |
| scShell | 0x02 | Remote shell access |
| scCommand | 0x04 | Remote command execution |
| scClientForwarding | 0x08 | Local (client-side) forwarding |
| scServerForwarding | 0x10 | Remote (server-side) forwarding |

# ClientFileEntry Property ([SFTPServer](#sftpserver-class) Class)

A container for file entry details.

## Syntax

```text
public FTPListEntry getClientFileEntry();
public void setClientFileEntry(FTPListEntry clientFileEntry);
```

## Remarks

This property is a placeholder for file entry details. Use it communicate file details from your code to the server component and back. Pass the contents of ClientFileEntry to the server with [SetClientFileEntry](#setclientfileentry-method-sftpserver-class) method, and retrieve them with [GetClientFileEntry](#getclientfileentry-method-sftpserver-class) method.

This property may come handy when customizing file system operations, such as file listings or attribute requests.

This property is not available at design time.

 Please refer to the [FTPListEntry](#ftplistentry-type) type for a complete list of fields.

# ClientKey Property ([SFTPServer](#sftpserver-class) Class)

Contains client's public key.

## Syntax

```text
public SSHKey getClientKey();
```

## Remarks

This property returns the current client's public key. Check this property inside your [AuthPublicKey](#authpublickey-event-sftpserver-class) event handler.

This property is read-only and not available at design time.

 Please refer to the [SSHKey](#sshkey-type) type for a complete list of fields.

# CompressionLevel Property ([SFTPServer](#sftpserver-class) Class)

Specifies the preferable compression level.

## Syntax

```text
public int getCompressionLevel();
public void setCompressionLevel(int compressionLevel);
```

## Default Value

9

## Remarks

Set this property before starting the server. Possible values range from 0 (lowest compression) to 9 (maximum compression). This property is ignored if compression wasn't accepted.

# ExternalCrypto Property ([SFTPServer](#sftpserver-class) Class)

Provides access to external signing and DC parameters.

## Syntax

```text
public ExternalCrypto getExternalCrypto();
```

## Remarks

Use this property to tune-up remote cryptography settings. SecureBlackbox supports two independent types of external cryptography: synchronous (based on the [ExternalSign](#externalsign-event-sftpserver-class) event) and asynchronous (based on the DC protocol and the DCAuth signing component).

This property is read-only.

 Please refer to the [ExternalCrypto](#externalcrypto-type) type for a complete list of fields.

# FIPSMode Property ([SFTPServer](#sftpserver-class) Class)

Reserved.

## Syntax

```text
public boolean isFIPSMode();
public void setFIPSMode(boolean FIPSMode);
```

## Default Value

False

## Remarks

This property is reserved for future use.

# ForceCompression Property ([SFTPServer](#sftpserver-class) Class)

This property specifies whether server explicitly requires data compression.

## Syntax

```text
public boolean isForceCompression();
public void setForceCompression(boolean forceCompression);
```

## Default Value

False

## Remarks

Set this property before starting the server. If it is set to true, the class will explicitly request data compression. If it is set to False, the class will support compression, although compression will be used only if the remote party doesn't support algorithms *without* compression.

# Host Property ([SFTPServer](#sftpserver-class) Class)

Specifies server's host name.

## Syntax

```text
public String getHost();
public void setHost(String host);
```

## Default Value

""

## Remarks

Use this property to set the host name for this server.

# MaxSFTPVersion Property ([SFTPServer](#sftpserver-class) Class)

Maximum SFTP version supported.

## Syntax

```text
public int getMaxSFTPVersion();
public void setMaxSFTPVersion(int maxSFTPVersion);
```

## Default Value

6

## Remarks

MaxSFTPVersion and [MinSFTPVersion](#minsftpversion-property-sftpserver-class) properties control the range of SFTP protocol versions supported by this server.

# MinSFTPVersion Property ([SFTPServer](#sftpserver-class) Class)

Minimum SFTP version supported.

## Syntax

```text
public int getMinSFTPVersion();
public void setMinSFTPVersion(int minSFTPVersion);
```

## Default Value

0

## Remarks

[MaxSFTPVersion](#maxsftpversion-property-sftpserver-class) and MinSFTPVersion properties control the range of SFTP protocol versions supported by this server.

# PinnedClient Property ([SFTPServer](#sftpserver-class) Class)

Populates the pinned client details.

## Syntax

```text
public SSHConnectionInfo getPinnedClient();
```

## Remarks

Use this property to access the details of the client connection previously pinned with [PinClient](#pinclient-method-sftpserver-class) method.

This property is read-only and not available at design time.

 Please refer to the [SSHConnectionInfo](#sshconnectioninfo-type) type for a complete list of fields.

# Port Property ([SFTPServer](#sftpserver-class) Class)

Specifies the listening port number.

## Syntax

```text
public int getPort();
public void setPort(int port);
```

## Default Value

22

## Remarks

Use this property to specify on which port the class will be listening to client connections.

# ReadOnly Property ([SFTPServer](#sftpserver-class) Class)

Specifies whether files on the server are read-only.

## Syntax

```text
public boolean isReadOnly();
public void setReadOnly(boolean readOnly);
```

## Default Value

False

## Remarks

Set this property to true to deny all client requests to change files on the server.

# ServerKeys Property ([SFTPServer](#sftpserver-class) Class)

The server's SSH keys.

## Syntax

```text
public SSHKeyList getServerKeys();
```

## Remarks

Use this property to provide a list of SSH private keys for the server endpoint.

 An SSH endpoint needs a private key to be able to accept secure connections. Apart from being employed for the handshake, the key is also used as a unique server identifier.

The collection may include more than one endpoint key. A typical usage scenario is to include two or three keys (ECDSA, RSA, and DSS), to cater for clients with different algorithm preferences.

This property is not available at design time.

 Please refer to the [SSHKey](#sshkey-type) type for a complete list of fields.

# SocketSettings Property ([SFTPServer](#sftpserver-class) Class)

Manages network connection settings.

## Syntax

```text
public SocketSettings getSocketSettings();
```

## Remarks

Use this property to tune up network connection parameters.

This property is read-only.

 Please refer to the [SocketSettings](#socketsettings-type) type for a complete list of fields.

# SSHSettings Property ([SFTPServer](#sftpserver-class) Class)

The SSH connection settings.

## Syntax

```text
public SSHSettings getSSHSettings();
```

## Remarks

Use this property to access and tune-up the SSH layer settings.

This property is read-only.

 Please refer to the [SSHSettings](#sshsettings-type) type for a complete list of fields.

# Users Property ([SFTPServer](#sftpserver-class) Class)

A collection of known users.

## Syntax

```text
public UserAccountList getUsers();
```

## Remarks

This property provides access to registered user database.

This property is not available at design time.

 Please refer to the [UserAccount](#useraccount-type) type for a complete list of fields.

# UseUTF8 Property ([SFTPServer](#sftpserver-class) Class)

Specifies whether UTF8 conversion is to be used when parsing file names.

## Syntax

```text
public boolean isUseUTF8();
public void setUseUTF8(boolean useUTF8);
```

## Default Value

False

## Remarks

This property specifies whether UTF8 conversion of filenames is used by the server. It is set automatically according to protocol flow, but user could also set it to the desired value.

# Cleanup Method ([SFTPServer](#sftpserver-class) Class)

Cleans up the server environment by purging expired sessions and cleaning caches.

## Syntax

```text
public void cleanup();
```

## Remarks

Call this method while the server is active to clean up the environment allocated for the server by releasing unused resources and cleaning caches.

# Config Method ([SFTPServer](#sftpserver-class) Class)

Sets or retrieves a configuration setting.

## Syntax

```text
public String config(String configurationString);
```

## Remarks

Config is a generic method available in every class. It is used to set and retrieve [configuration settings](#config-settings-sftpserver-class) 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](#config-settings-sftpserver-class), you must call *Config("PROPERTY")*. The value will be returned as a string.

# DoAction Method ([SFTPServer](#sftpserver-class) Class)

Performs an additional action.

## Syntax

```text
public String doAction(String actionID, String 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 (case insensitive) of the action is provided in the *ActionID* parameter.

*ActionParams* contains the value of a single parameter, or a list of multiple parameters for the action in the form of *PARAM1=VALUE1;PARAM2=VALUE2;...*.

Common ActionIDs:

|  |  |  |  |
| --- | --- | --- | --- |
| Action | Parameters | Returned value | Description |
| ResetTrustedListCache | none | none | Clears the cached list of trusted lists. |
| ResetCertificateCache | none | none | Clears the cached certificates. |
| ResetCRLCache | none | none | Clears the cached CRLs. |
| ResetOCSPResponseCache | none | none | Clears the cached OCSP responses. |

# DropClient Method ([SFTPServer](#sftpserver-class) Class)

Terminates a client connection.

## Syntax

```text
public void dropClient(long connectionId, boolean forced);
```

## Remarks

Call this method to shut down a connected client. *Forced* indicates whether the connection should be closed in a graceful manner.

# GetClientBuffer Method ([SFTPServer](#sftpserver-class) Class)

Acquires a piece of operation data.

## Syntax

```text
public byte[] getClientBuffer(long connectionID, String handle);
```

## Remarks

Use this method to obtain a piece of data relevant to a transfer operation in a thread-safe way.

A typical place to call this method is inside the [WriteFile](#writefile-event-sftpserver-class) event handler, when implementing customized file transfers.

# GetClientFileEntry Method ([SFTPServer](#sftpserver-class) Class)

Acquires file entry details from the class.

## Syntax

```text
public void getClientFileEntry(long connectionID, String handle);
```

## Remarks

Use this method to acquire the details of a file entry from the server in atomic and thread-safe way. After this method completes, the entry details will be propagated in [ClientFileEntry](#clientfileentry-property-sftpserver-class) property.

When calling this method, pass the client connection ID in *ConnectionID* property, and the opened file handle (if needed) in *Handle* property.

# ListClients Method ([SFTPServer](#sftpserver-class) Class)

Enumerates the connected clients.

## Syntax

```text
public String listClients();
```

## Remarks

This method enumerates the connected clients. It returns a list of strings, with each string being of 'ConnectionID|Address|Port' format, and representing a single connection.

# PinClient Method ([SFTPServer](#sftpserver-class) Class)

Takes a snapshot of the connection's properties.

## Syntax

```text
public void pinClient(long connectionId);
```

## Remarks

Use this method to take a snapshot of a connected client. The captured properties are populated in [PinnedClient](#pinnedclient-property-sftpserver-class) property.

# Reset Method ([SFTPServer](#sftpserver-class) Class)

Resets the class settings.

## Syntax

```text
public void reset();
```

## Remarks

Reset is a generic method available in every class.

# SetClientBuffer Method ([SFTPServer](#sftpserver-class) Class)

Commits a data buffer to the server class.

## Syntax

```text
public void setClientBuffer(long connectionID, String handle, byte[] value);
```

## Remarks

Use this method to commit a data buffer passed via the *Value* parameter to the server control in a thread-safe way.

One example where you might need to pass your buffer to the server is when customizing upload operations via [ReadFile](#readfile-event-sftpserver-class) event.

# SetClientFileEntry Method ([SFTPServer](#sftpserver-class) Class)

Commits the file entry details to the class.

## Syntax

```text
public void setClientFileEntry(long connectionID, String handle);
```

## Remarks

Use this method to commit the file entry details configured in [ClientFileEntry](#clientfileentry-property-sftpserver-class) property to the server object in a thread-safe way. Pass the client's connection ID via *ConnectionID* property, and the file entry's handle via *Handle*.

# Start Method ([SFTPServer](#sftpserver-class) Class)

Starts SFTP server operation.

## Syntax

```text
public void start();
```

## Remarks

Call this method to start listening to incoming connections.

# Stop Method ([SFTPServer](#sftpserver-class) Class)

Stops SFTP server.

## Syntax

```text
public void stop();
```

## Remarks

Call this method to close all connections and stop listening to clients.

# Accept Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when new incoming connection is accepted.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void accept(SFTPServerAcceptEvent e) {}
  ...
}

public class SFTPServerAcceptEvent {
  public String remoteAddress;
  public int remotePort;
  public boolean accept; //read-write
}
```

## Remarks

This event is fired by the class before a new incoming connection is accepted. *RemoteAddress* contains the IP address of the connecting client. Use the *Accept* parameter to either accept, or reject the connection.

# AfterCreateDirectory Event ([SFTPServer](#sftpserver-class) Class)

This event indicates completion of directory creation request.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void afterCreateDirectory(SFTPServerAfterCreateDirectoryEvent e) {}
  ...
}

public class SFTPServerAfterCreateDirectoryEvent {
  public long connectionID;
  public String path;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired to report completion of a directory creation request. The *ConnectionID* parameter specifies in which session the request was received, the *Path* specifies the directory path, and the *OperationStatus* contains the operation result.

If needed, you can amend the *OperationStatus* to return a different operation result:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# AfterRemove Event ([SFTPServer](#sftpserver-class) Class)

This event indicates completion of file removal request.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void afterRemove(SFTPServerAfterRemoveEvent e) {}
  ...
}

public class SFTPServerAfterRemoveEvent {
  public long connectionID;
  public String path;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to delete a file or directory has been processed by the server. The *ConnectionID* parameter specifies the session in which the request was received. *OperationStatus* contains the operation result.

If needed, you can amend the *OperationStatus* to return a different operation result:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# AfterRenameFile Event ([SFTPServer](#sftpserver-class) Class)

This event indicates completion of a file rename operation.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void afterRenameFile(SFTPServerAfterRenameFileEvent e) {}
  ...
}

public class SFTPServerAfterRenameFileEvent {
  public long connectionID;
  public String oldPath;
  public String newPath;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to rename a file (from *OldPath* to *NewPath*) has been processed. The *ConnectionID* parameter specifies in which session the request was received, and *OperationStatus* contains the operation result.

If needed, you can amend the *OperationStatus* to return a different operation result:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# AfterRequestAttributes Event ([SFTPServer](#sftpserver-class) Class)

This event indicates completion of file attributes request.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void afterRequestAttributes(SFTPServerAfterRequestAttributesEvent e) {}
  ...
}

public class SFTPServerAfterRequestAttributesEvent {
  public long connectionID;
  public String path;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request for get file attributes has been processed by the server. The *ConnectionID* parameter specifies in which session the request was received. *OperationStatus* contains the result of the operation.

If needed, you can amend the *OperationStatus* to return a different operation result:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# AfterSetAttributes Event ([SFTPServer](#sftpserver-class) Class)

This event indicates completion of a set attributes request.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void afterSetAttributes(SFTPServerAfterSetAttributesEvent e) {}
  ...
}

public class SFTPServerAfterSetAttributesEvent {
  public long connectionID;
  public String path;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request for set file attributes has been processed. The *ConnectionID* parameter specifies in which session the request was received. The *OperationStatus* parameter contains the operation result.

If needed, you can amend the *OperationStatus* to return a different operation result:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# AuthAttempt Event ([SFTPServer](#sftpserver-class) Class)

Reports a user authentication attempt.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void authAttempt(SFTPServerAuthAttemptEvent e) {}
  ...
}

public class SFTPServerAuthAttemptEvent {
  public long connectionID;
  public String username;
  public int authType;
  public boolean accept; //read-write
}
```

## Remarks

*ConnectionID* identifies the session, *Username* specifies client's username, and *AuthType* specifies the authentication type. Use the *Accept* parameter to accept or decline the attempt.

Supported authentication types:

|  |  |  |
| --- | --- | --- |
| atRhosts | 0x01 | RHOSTS file authentication. Rarely used today. |
| atPublicKey | 0x02 | Public key (sometimes called private key) authentication |
| atPassword | 0x04 | Password-based authentication |
| atHostbased | 0x08 | Hostbased authentication |
| atKeyboard | 0x10 | Keyboard-interactive authentication. This is often used in place of generic password authentication. |
| atGssWithMic | 0x20 | GSS authentication |
| atGssKeyex | 0x40 | GSS authentication with key exchange |
| atPublicKeyAgent | 0x80 | Public key agent authentication |

# AuthFailed Event ([SFTPServer](#sftpserver-class) Class)

Reports user authentication failure.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void authFailed(SFTPServerAuthFailedEvent e) {}
  ...
}

public class SFTPServerAuthFailedEvent {
  public long connectionID;
  public String username;
  public int authType;
}
```

## Remarks

*ConnectionID* identifies the session, *Username* specify client's username, and *AuthType* specifies what authentication type was used.

Supported authentication types:

|  |  |  |
| --- | --- | --- |
| atRhosts | 0x01 | RHOSTS file authentication. Rarely used today. |
| atPublicKey | 0x02 | Public key (sometimes called private key) authentication |
| atPassword | 0x04 | Password-based authentication |
| atHostbased | 0x08 | Hostbased authentication |
| atKeyboard | 0x10 | Keyboard-interactive authentication. This is often used in place of generic password authentication. |
| atGssWithMic | 0x20 | GSS authentication |
| atGssKeyex | 0x40 | GSS authentication with key exchange |
| atPublicKeyAgent | 0x80 | Public key agent authentication |

# AuthPassword Event ([SFTPServer](#sftpserver-class) Class)

This event is fired on password authentication attempt from a client.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void authPassword(SFTPServerAuthPasswordEvent e) {}
  ...
}

public class SFTPServerAuthPasswordEvent {
  public long connectionID;
  public String username;
  public String password;
  public boolean accept; //read-write
  public boolean forceChangePassword; //read-write
}
```

## Remarks

Parameters *Username* and *Password* contain user credentials. If they are correct, set *Accept* to true. You can request password change by setting *ForceChangePassword* to true.

# AuthPublicKey Event ([SFTPServer](#sftpserver-class) Class)

This event is fired on public key authentication attempt from a client.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void authPublicKey(SFTPServerAuthPublicKeyEvent e) {}
  ...
}

public class SFTPServerAuthPublicKeyEvent {
  public long connectionID;
  public String username;
  public boolean accept; //read-write
}
```

## Remarks

*Username* specifies client's username, and *Accept* is used to accept or reject authentication.

The users public key can be accessed via the [ClientKey](#clientkey-property-sftpserver-class) property. This event is guarded with a critical section so the property always contains the correct key.

# AuthSucceeded Event ([SFTPServer](#sftpserver-class) Class)

Reports a successful user authentication.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void authSucceeded(SFTPServerAuthSucceededEvent e) {}
  ...
}

public class SFTPServerAuthSucceededEvent {
  public long connectionID;
  public String username;
  public int authType;
}
```

## Remarks

*ConnectionID* identifies the session, *Username* specify client's username, and *AuthType* specifies what authentication type was used.

Supported authentication types:

|  |  |  |
| --- | --- | --- |
| atRhosts | 0x01 | RHOSTS file authentication. Rarely used today. |
| atPublicKey | 0x02 | Public key (sometimes called private key) authentication |
| atPassword | 0x04 | Password-based authentication |
| atHostbased | 0x08 | Hostbased authentication |
| atKeyboard | 0x10 | Keyboard-interactive authentication. This is often used in place of generic password authentication. |
| atGssWithMic | 0x20 | GSS authentication |
| atGssKeyex | 0x40 | GSS authentication with key exchange |
| atPublicKeyAgent | 0x80 | Public key agent authentication |

# BeforeCreateDirectory Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to create a directory.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeCreateDirectory(SFTPServerBeforeCreateDirectoryEvent e) {}
  ...
}

public class SFTPServerBeforeCreateDirectoryEvent {
  public long connectionID;
  public String path;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to create a directory has been received. The *ConnectionID* parameter specifies in which session the request was received.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeDownloadFile Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a download file request is received.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeDownloadFile(SFTPServerBeforeDownloadFileEvent e) {}
  ...
}

public class SFTPServerBeforeDownloadFileEvent {
  public long connectionID;
  public String path;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to download file is received from the client. The *ConnectionID* parameter specifies in which session the request was received.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeFind Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to find files and folders in Path.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeFind(SFTPServerBeforeFindEvent e) {}
  ...
}

public class SFTPServerBeforeFindEvent {
  public long connectionID;
  public String path;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to find files and folders in *Path* has been received. The *ConnectionID* parameter specifies in which session the request was received.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeOpenClientForwarding Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to set up client-side (local) forwarding channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeOpenClientForwarding(SFTPServerBeforeOpenClientForwardingEvent e) {}
  ...
}

public class SFTPServerBeforeOpenClientForwardingEvent {
  public long connectionID;
  public String destHost; //read-write
  public int destPort; //read-write
  public String srcHost;
  public int srcPort;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to open a client forwarding has been received. The *ConnectionID* parameter specifies in which session the request was received.

If permitted, the server will open a connection to DestHost:DestPort and start forwarding any data received from the client to that endpoint. You can enable or disable client forwarding blanketly via the [Capabilities](#capabilities-property-sftpserver-class) property.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeOpenCommand Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests a command channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeOpenCommand(SFTPServerBeforeOpenCommandEvent e) {}
  ...
}

public class SFTPServerBeforeOpenCommandEvent {
  public long connectionID;
  public String command; //read-write
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to open a command has been received. The *ConnectionID* parameter specifies in which session the request was received.

If permitted, the component will launch the command in a separate process. Note that allowing command access to all clients can be dangerous. You can enable or disable command support blanketly via the [Capabilities](#capabilities-property-sftpserver-class) property.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeOpenServerForwarding Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when the server has received an incoming connection and needs to set up server-side (remote) forwarding channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeOpenServerForwarding(SFTPServerBeforeOpenServerForwardingEvent e) {}
  ...
}

public class SFTPServerBeforeOpenServerForwardingEvent {
  public long connectionID;
  public String localHost;
  public int localPort;
  public String srcHost;
  public int srcPort;
  public int action; //read-write
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received.

If permitted, the server will accept the connection and ask the client to confirm forwarding to DestHost:DestPort. If that is successful, the server will fire the [OpenServerForwarding](#openserverforwarding-event-sftpserver-class) event.

You can enable or disable client forwarding blanketly via the [Capabilities](#capabilities-property-sftpserver-class) property.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeOpenShell Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests a shell channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeOpenShell(SFTPServerBeforeOpenShellEvent e) {}
  ...
}

public class SFTPServerBeforeOpenShellEvent {
  public long connectionID;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to open a shell has been received. The *ConnectionID* parameter specifies in which session the request was received.

If permitted, the client will be able to send commands to the shell. Note that allowing shell access to all clients can be dangerous. You can enable or disable shell access blanketly via the [Capabilities](#capabilities-property-sftpserver-class) property.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeRemove Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to delete a file or directory.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeRemove(SFTPServerBeforeRemoveEvent e) {}
  ...
}

public class SFTPServerBeforeRemoveEvent {
  public long connectionID;
  public String path;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to delete a file or directory is received from the client. The *ConnectionID* parameter specifies in which session the request was received.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeRenameFile Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to rename a file.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeRenameFile(SFTPServerBeforeRenameFileEvent e) {}
  ...
}

public class SFTPServerBeforeRenameFileEvent {
  public long connectionID;
  public String oldPath;
  public String newPath;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to rename a file (from *OldPath* to *NewPath*) is received from the client. The *ConnectionID* parameter specifies in which session the request was received.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeRequestAttributes Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to get file attributes.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeRequestAttributes(SFTPServerBeforeRequestAttributesEvent e) {}
  ...
}

public class SFTPServerBeforeRequestAttributesEvent {
  public long connectionID;
  public String path;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to get file attributes has been received. The *ConnectionID* parameter specifies in which session the request was received.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeSetAttributes Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to set file attributes.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeSetAttributes(SFTPServerBeforeSetAttributesEvent e) {}
  ...
}

public class SFTPServerBeforeSetAttributesEvent {
  public long connectionID;
  public String path;
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to set file attributes has been received. The *ConnectionID* parameter specifies in which session the request was received.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# BeforeUploadFile Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when an upload file request is received.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void beforeUploadFile(SFTPServerBeforeUploadFileEvent e) {}
  ...
}

public class SFTPServerBeforeUploadFileEvent {
  public long connectionID;
  public String path;
  public int action; //read-write
}
```

## Remarks

This event is fired when an upload file request is received from the client. The *ConnectionID* parameter specifies in which session the request was received, and *Path* specifies the location on the server where the file needs to be saved.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# CloseClientForwarding Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client has closed a previously opened forwarding channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void closeClientForwarding(SFTPServerCloseClientForwardingEvent e) {}
  ...
}

public class SFTPServerCloseClientForwardingEvent {
  public long connectionID;
  public String destHost;
  public int destPort;
  public String srcHost;
  public int srcPort;
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received.

# CloseCommand Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client has closed a previously opened SSH command channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void closeCommand(SFTPServerCloseCommandEvent e) {}
  ...
}

public class SFTPServerCloseCommandEvent {
  public long connectionID;
  public String command;
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received.

# CloseFile Event ([SFTPServer](#sftpserver-class) Class)

This event instructs the application to close an opened file.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void closeFile(SFTPServerCloseFileEvent e) {}
  ...
}

public class SFTPServerCloseFileEvent {
  public long connectionID;
  public String handle;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired upon receipt of a close-file packet from a client. Servers implementing virtualized transfers must close the previously opened local file referenced by *Handle* in this event handler. No further operations are allowed with the closed file.

Set *OperationStatus* to one of the following values to report the result of this operation to the client:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# CloseServerForwarding Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client has closed a previously opened forwarding channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void closeServerForwarding(SFTPServerCloseServerForwardingEvent e) {}
  ...
}

public class SFTPServerCloseServerForwardingEvent {
  public long connectionID;
  public String localHost;
  public int localPort;
  public String srcHost;
  public int srcPort;
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received.

# CloseShell Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client has closed a previously opened shell channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void closeShell(SFTPServerCloseShellEvent e) {}
  ...
}

public class SFTPServerCloseShellEvent {
  public long connectionID;
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received.

# Connect Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a remote connection has been established.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void connect(SFTPServerConnectEvent e) {}
  ...
}

public class SFTPServerConnectEvent {
  public long connectionID;
  public String remoteAddress;
  public int remotePort;
}
```

## Remarks

*ConnectionID* contains a session identifier, and *RemoteAddress* specifies the client's IP address.

# CreateDirectory Event ([SFTPServer](#sftpserver-class) Class)

This event instructs the application to create a directory.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void createDirectory(SFTPServerCreateDirectoryEvent e) {}
  ...
}

public class SFTPServerCreateDirectoryEvent {
  public long connectionID;
  public String path;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to create a directory has been received and needs to be served (virtualized) by the application. The *ConnectionID* parameter specifies the session that has communicated the request, and *Path* contains the name of the directory to be created.

Set *OperationStatus* to one of the below values according to the outcome of the request processing:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# Disconnect Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client has disconnected.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void disconnect(SFTPServerDisconnectEvent e) {}
  ...
}

public class SFTPServerDisconnectEvent {
  public long connectionID;
}
```

## Remarks

This event reports loss of connection to the client within the session specified by *ConnectionID*.

# Error Event ([SFTPServer](#sftpserver-class) Class)

Information about errors during data delivery.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void error(SFTPServerErrorEvent e) {}
  ...
}

public class SFTPServerErrorEvent {
  public long connectionID;
  public int errorCode;
  public boolean fatal;
  public boolean remote;
  public String description;
}
```

## Remarks

The event is fired in case of exceptional conditions during message processing.

*ErrorCode* contains an error code and *Description* contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the [SFTP](#trappable-errors-sftpserver-class) section.

# ExternalSign Event ([SFTPServer](#sftpserver-class) Class)

Handles remote or external signing initiated by the server protocol.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void externalSign(SFTPServerExternalSignEvent e) {}
  ...
}

public class SFTPServerExternalSignEvent {
  public long connectionID;
  public String operationId;
  public String hashAlgorithm;
  public String pars;
  public String data;
  public String signedData; //read-write
}
```

## 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 class via the *SignedData* parameter.

*OperationId* provides a comment about the operation and its origin. It depends on the exact class being used, and may be empty. *HashAlgorithm* specifies the hash algorithm being used for the operation, and *Pars* contains algorithm-dependent parameters.

The class uses base16 (hex) encoding for the *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 the .NET RSACryptoServiceProvider class may look like the following:

```text
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();
};
```

# FindClose Event ([SFTPServer](#sftpserver-class) Class)

This event signifies the completion of a custom file listing operation.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void findClose(SFTPServerFindCloseEvent e) {}
  ...
}

public class SFTPServerFindCloseEvent {
  public long connectionID;
  public String handle;
  public int operationStatus; //read-write
}
```

## Remarks

FindClose notifies your code about the completion of a custom file listing request. Use it in conjunction with [FindFirst](#findfirst-event-sftpserver-class) and [FindNext](#findnext-event-sftpserver-class) to handle file listing requests manually.

See [FindFirst](#findfirst-event-sftpserver-class) topic for the details on implementing customized file listing request processing.

Set *OperationStatus* to one of the below values according to the outcome of the request processing:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# FindFirst Event ([SFTPServer](#sftpserver-class) Class)

This event signifies the start of the custom file listing retrieval mechanism.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void findFirst(SFTPServerFindFirstEvent e) {}
  ...
}

public class SFTPServerFindFirstEvent {
  public long connectionID;
  public String path;
  public int operationStatus; //read-write
  public String handle; //read-write
}
```

## Remarks

FindFirst, [FindNext](#findnext-event-sftpserver-class), and [FindClose](#findclose-event-sftpserver-class) events represent a mechanism for providing customized file listings to class. They are only fired if *Action* parameter of the preceding [BeforeFind](#beforefind-event-sftpserver-class) event was set to *fraCustom*.

The behaviour of these events mimics that of the standard FindFirst/FindNext/FindClose functions found in many operating systems/frameworks. FindFirst fires once to request the first list entry; [FindNext](#findnext-event-sftpserver-class) then fires continuously in a loop to request all subsequent entries. To indicate that the listing is over, set *OperationStatus* parameter to *ostEOF*. Not doing so may lead to an endless loop and session freeze, as the component would continue firing [FindNext](#findnext-event-sftpserver-class) infinitely waiting for the EOF marker.

The handlers for both FindFirst and [FindNext](#findnext-event-sftpserver-class) events should be implemented in the following way: if there are more entries in the directory to pass back to the server component,

- set *OperationStatus* to *ostOK*,
- fill in [ClientFileEntry](#clientfileentry-property-sftpserver-class) with the details of the next entry,
- commit the entry to the server using [SetClientFileEntry](#setclientfileentry-method-sftpserver-class) method.

 When all the entries from the requested directory have been passed to the server component, set *OperationStatus* to *ostEOF*. The server will then fire [FindClose](#findclose-event-sftpserver-class) event to notify your code that the file listing is completed.

Use the by-ref *Handle* parameter to assign a handle (a unique identifier) to the file listing procedure inside the FindFirst event handler. This identifier will then be passed to all subsequent [FindNext](#findnext-event-sftpserver-class) and [FindClose](#findclose-event-sftpserver-class) calls to let your code chain the events together.

The *ConnectionID* parameter specifies in which SFTP session the request was received, and *Path* indicates the requested directory.

The following operation status constants are available, besides the ones referenced above:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# FindNext Event ([SFTPServer](#sftpserver-class) Class)

This event retrieves the next entry of a custom file listing.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void findNext(SFTPServerFindNextEvent e) {}
  ...
}

public class SFTPServerFindNextEvent {
  public long connectionID;
  public String handle;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired repeatedly after [FindFirst](#findfirst-event-sftpserver-class) to retrieve the directory contents entry-by-entry. Please see the [FindFirst](#findfirst-event-sftpserver-class) topic for more details about implementing a handler of this event.

Remember to set *OperationStatus* to *ostEOF* when there are no more entries left to close the listing operation. If there are more entries to pass, set it to *ostOK*. Other possible values are given in the table below:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# ListeningStarted Event ([SFTPServer](#sftpserver-class) Class)

Fires when the server has started accepting connections on a local port.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void listeningStarted(SFTPServerListeningStartedEvent e) {}
  ...
}

public class SFTPServerListeningStartedEvent {
  public String host;
  public int port;
}
```

## Remarks

This event is fired when the server is ready to accept incoming SSH/SFTP connections.

# ListeningStopped Event ([SFTPServer](#sftpserver-class) Class)

Fires when the server has stopped accepting connections on a local port.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void listeningStopped(SFTPServerListeningStoppedEvent e) {}
  ...
}

public class SFTPServerListeningStoppedEvent {
  public String host;
  public int port;
}
```

## Remarks

This event is fired when the server has closed the listening socket and can no longer accept incoming SSH/SFTP connections.

# Notification Event ([SFTPServer](#sftpserver-class) Class)

This event notifies the application about an underlying control flow event.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void notification(SFTPServerNotificationEvent e) {}
  ...
}

public class SFTPServerNotificationEvent {
  public String eventID;
  public String eventParam;
}
```

## Remarks

The class fires this event to let the application know about some event, occurrence, or milestone in the class. 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 the *EventID* parameter. *EventParam* contains any parameters accompanying the occurrence. Depending on the type of the class, the exact action it is performing, or the document being processed, one or both may be omitted.

This class can fire this event with the following *EventID* values:

|  |  |
| --- | --- |
| FileOpen | Notifies your code about the file being opened, which is typically an indicator of the initiation of the transfer operation. The EventParam value passed with this EventID is a string of the following format: ConnectionID=3;Path=/dir/file;Handle=x5DshAk8;Modes=48;Access=0;DesiredAccess=8 This EventID only fires if the NotifyOnFileOperations configuration property is set to true. |
| FileRead | Notifies your code about the file chunk being requested. The EventParam value passed with this EventID is a string of the following format: ConnectionID=7;Handle=x5DshAk8;Offset=2048;Count=1024;Read=1021 This EventID only fires if the NotifyOnFileOperations configuration property is set to true. |
| FileWrite | Notifies your code about the file chunk being received. The EventParam value passed with this EventID is a string of the following format: ConnectionID=7;Handle=x5DshAk8;Offset=2048;Count=1024 This EventID only fires if the NotifyOnFileOperations configuration property is set to true. |
| FileClose | Notifies your code about the closure of an opened file. The EventParam value passed with this EventID is a string of the following format: ConnectionID=7;Handle=x5DshAk8;Modes=48 This EventID only fires if the NotifyOnFileOperations configuration property is set to true. |
| OpenShell | Notifies your code about an opened shell tunnel. The EventParam has the following format: ConnectionID=9;LocalChannel=1;RemoteChannel=2 |
| OpenCommand | Notifies your code about an opened command tunnel. The EventParam value has the following format: ConnectionID=8;LocalChannel=3;RemoteChannel=3;Command=ls -l |
| CloseShell | Indicates the closure of a shell tunnel. The EventParam format is the same as with the OpenShell event ID. |
| CloseCommand | Indicates the closure of a command tunnel. The EventParam format is the same as with the OpenCommand event ID. |
| Banner | Notifies the application that the banner has been prepared and is about to be sent to the other side. The application can adjust the content of the banner by using Banner[ConnID] and Lang[ConnID] configuration settings. |
| ListeningStarted | Notifies the application that the server has started listening for incoming connections. |
| ListeningStopped | Notifies the application that the server has stopped listening to incoming connections. |

# OpenClientForwarding Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client opens a client-side (local) forwarding channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void openClientForwarding(SFTPServerOpenClientForwardingEvent e) {}
  ...
}

public class SFTPServerOpenClientForwardingEvent {
  public long connectionID;
  public String destHost;
  public int destPort;
  public String srcHost;
  public int srcPort;
}
```

## Remarks

This event notifies the application that a client-side forwarding channel has been set up. The *ConnectionID* parameter specifies in which session the request was received.

The *DestHost* and *DestPort* parameters specify the address that the data received from the client will be forwarded to. The *SrcHost* and *SrcPort* specify the connection origin that is reported by the client. Note that the details of the origin cannot be verified.

# OpenCommand Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client has opened an SSH command channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void openCommand(SFTPServerOpenCommandEvent e) {}
  ...
}

public class SFTPServerOpenCommandEvent {
  public long connectionID;
  public String command;
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received.

The component fires [CloseCommand](#closecommand-event-sftpserver-class) when the command channel is closed.

# OpenFile Event ([SFTPServer](#sftpserver-class) Class)

This event instructs the application to handle the file open request.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void openFile(SFTPServerOpenFileEvent e) {}
  ...
}

public class SFTPServerOpenFileEvent {
  public long connectionID;
  public String path;
  public int modes;
  public int access;
  public int operationStatus; //read-write
  public String handle; //read-write
}
```

## Remarks

This event is fired when a file open request is received from the client and needs to be handled (virtualized) by the server. The *ConnectionID* parameter specifies in which session the request was received, and *Path* specifies the location of the file.

*Modes* can be a combination of one or several file open mode flags:

|  |  |
| --- | --- |
| cfmRead | 1 |
| cfmWrite | 2 |
| cfmAppend | 4 |
| cfmCreate | 8 |
| cfmTruncate | 16 |
| cfmExcl | 32 |
| cfmText | 64 |
| cfmOpenOrCreate | 128 |
| cfmAppendAtomic | 256 |
| cfmNoFollow | 512 |
| cfmDeleteOnClose | 1024 |

Different client applications may provide different selections of mode flags. For example, some clients specify (cfmCreate + cfmTruncate) when overwriting files, whereas others would specify cfmOpenOrCreate. Please make sure your code is prepared to receive different combinations of flags here and handles them gracefully.

The *Access* parameter provides additional file access modifiers:

|  |  |
| --- | --- |
| cfaReadLock | 1 |
| cfaWriteLock | 2 |
| cfaDeleteLock | 4 |
| cfaBlockAdvisory | 8 |

 These parameter may also contain a combination of the above flags. Access modifiers are only supported in SFTPv6, and in practice are rarely used by client applications.

The *Handle* string represents a unique identifier of the opened file, similar to file handles used in Windows or Unix APIs. Handles are unique across all files opened at the same time. Class generates handles automatically, but you can update the auto-generated values with your own in this event handler (just remember to keep them unique).

Set *OperationStatus* parameter in accordance with the outcome of the operation to one of the values given below:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# OpenServerForwarding Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when the server opens a server-side (remote) forwarding channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void openServerForwarding(SFTPServerOpenServerForwardingEvent e) {}
  ...
}

public class SFTPServerOpenServerForwardingEvent {
  public long connectionID;
  public String localHost;
  public int localPort;
  public String srcHost;
  public int srcPort;
}
```

## Remarks

This event notifies the application that a server-side forwarding channel has been set up. The *ConnectionID* parameter specifies in which session the request was received.

The *DestHost* and *DestPort* parameters specify the address that the data received from the connection accepted by the server will be forwarded to, according to the client. The *SrcHost* and *SrcPort* specify the connection origin.

# OpenShell Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client has opened a shell channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void openShell(SFTPServerOpenShellEvent e) {}
  ...
}

public class SFTPServerOpenShellEvent {
  public long connectionID;
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received.

The component fires [CloseShell](#closeshell-event-sftpserver-class) when the shell channel is closed.

# ReadFile Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a file read request is received.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void readFile(SFTPServerReadFileEvent e) {}
  ...
}

public class SFTPServerReadFileEvent {
  public long connectionID;
  public String handle;
  public long offset;
  public int size;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to read block from a file is received from the client. The *ConnectionID* parameter specifies in which session the request was received, and *Handle* indicates an opened file handle. *Offset* and *Size* denote the location and size of the file piece.

Inside the event handler, pass the appropriate file chunk to the component via [SetClientBuffer](#setclientbuffer-method-sftpserver-class) method.

Set *OperationStatus* to one of the below values according to the outcome of the request processing:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# Remove Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to delete a file or directory.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void remove(SFTPServerRemoveEvent e) {}
  ...
}

public class SFTPServerRemoveEvent {
  public long connectionID;
  public String path;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to delete a file or directory is received from the client. The *ConnectionID* parameter specifies in which session the request was received.

Set *OperationStatus* to one of the below values according to the outcome of the request processing:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# RenameFile Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests to rename a file.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void renameFile(SFTPServerRenameFileEvent e) {}
  ...
}

public class SFTPServerRenameFileEvent {
  public long connectionID;
  public String oldPath;
  public String newPath;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to rename a file (from *OldPath* to *NewPath*) is received from the client. The *ConnectionID* parameter specifies in which session the request was received.

Set *OperationStatus* to one of the below values according to the outcome of the request processing:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# RequestAttributes Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a get file attributes request is received.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void requestAttributes(SFTPServerRequestAttributesEvent e) {}
  ...
}

public class SFTPServerRequestAttributesEvent {
  public long connectionID;
  public String path;
  public String handle;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to get file attributes is received from the client. The *ConnectionID* parameter specifies in which session the request was received, and *Path* specifies the file location where the attributes need to be retrieved.

Set *OperationStatus* to one of the below values according to the outcome of the request processing:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# ServerForwardingCancel Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when the client cancels a previously negotiated server-side (remote) forwarding.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void serverForwardingCancel(SFTPServerServerForwardingCancelEvent e) {}
  ...
}

public class SFTPServerServerForwardingCancelEvent {
  public long connectionID;
  public String localHost;
  public int localPort;
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received. The *LocalHost*:*LocalPort* specify the endpoint that the server is listening on.

After receiving the cancellation request the server will no longer listen to connections at the mentioned endpoint.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# ServerForwardingOpenFailed Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when the client rejects the server request to establish a server forwarding channel.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void serverForwardingOpenFailed(SFTPServerServerForwardingOpenFailedEvent e) {}
  ...
}

public class SFTPServerServerForwardingOpenFailedEvent {
  public long connectionID;
  public String localHost;
  public int localPort;
  public String srcHost;
  public int srcPort;
}
```

## Remarks

This event can follow the [BeforeOpenServerForwarding](#beforeopenserverforwarding-event-sftpserver-class) and [OpenServerForwarding](#openserverforwarding-event-sftpserver-class) if the client rejects the server request to forward an accepted TCP connection.

The *ConnectionID* parameter specifies in which session the request was received. The *LocalHost*:*LocalPort* specify the endpoint that the server has received the connection on.

# ServerForwardingRequest Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when the client requests the server to set up server-side (remote) forwarding.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void serverForwardingRequest(SFTPServerServerForwardingRequestEvent e) {}
  ...
}

public class SFTPServerServerForwardingRequestEvent {
  public long connectionID;
  public String localHost;
  public int localPort; //read-write
  public int action; //read-write
}
```

## Remarks

The *ConnectionID* parameter specifies in which session the request was received. The *LocalHost*:*LocalPort* specify the endpoint that the client expects the server to listen on. The server may choose to use a different port, in which case please adjust the *LocalPort* in the event handler.

If permitted, the server will open the requested port and start listening to incoming connections. All such connections will be reported via [BeforeOpenServerForwarding](#beforeopenserverforwarding-event-sftpserver-class) and [OpenServerForwarding](#openserverforwarding-event-sftpserver-class) events.

You can enable or disable server forwarding blanketly via the [Capabilities](#capabilities-property-sftpserver-class) property.

Choose *Action* as one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# SessionClosed Event ([SFTPServer](#sftpserver-class) Class)

Reports session closure.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void sessionClosed(SFTPServerSessionClosedEvent e) {}
  ...
}

public class SFTPServerSessionClosedEvent {
  public long connectionID;
}
```

## Remarks

This event is fired when a connection identified by *ConnectionID* has been gracefully closed.

# SessionEstablished Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a new session is established.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void sessionEstablished(SFTPServerSessionEstablishedEvent e) {}
  ...
}

public class SFTPServerSessionEstablishedEvent {
  public long connectionID;
}
```

## Remarks

This event is fired when a new connection identified by *ConnectionID* has been established with a client.

# SetAttributes Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when an set file attributes request is received.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void setAttributes(SFTPServerSetAttributesEvent e) {}
  ...
}

public class SFTPServerSetAttributesEvent {
  public long connectionID;
  public String path;
  public String handle;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to set file attributes is received from the client. The *ConnectionID* parameter specifies in which session the request was received, and *Path* specifies the file location which the attributes needs to be set.

Set *OperationStatus* to one of the below values according to the outcome of the request processing:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# TranslatePath Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a client requests the server to translate a path to its absolute form.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void translatePath(SFTPServerTranslatePathEvent e) {}
  ...
}

public class SFTPServerTranslatePathEvent {
  public long connectionID;
  public String path;
  public String absolutePath; //read-write
  public int action; //read-write
}
```

## Remarks

This event is fired when a request to translate a relative path to the corresponding absolute path is received. The *ConnectionID* parameter specifies the session in which the request was received.

You can let the server do the translation automatically according to the default file system rules, or take care of it yourself. Use the *Action* parameter to specify who is responsible for the translation. If doing the translation manually, return the translated path via the *AbsolutePath* parameter. *Action* can take one of the following values:

|  |  |  |
| --- | --- | --- |
| fraAuto | 1 | Handle the requested action automatically by the server |
| fraCustom | 2 | Override the action using the user code logic |
| fraAbort | 3 | Abort the requested action |

# WriteFile Event ([SFTPServer](#sftpserver-class) Class)

This event is fired when a file write request is received.

## Syntax

```text
public class DefaultSFTPServerEventListener implements SFTPServerEventListener {
  ...
  public void writeFile(SFTPServerWriteFileEvent e) {}
  ...
}

public class SFTPServerWriteFileEvent {
  public long connectionID;
  public String handle;
  public long offset;
  public int operationStatus; //read-write
}
```

## Remarks

This event is fired when a request to write a data block to a file is received from the client. The *ConnectionID* parameter specifies the session the request originates from. The *Handle* parameter references the opened file where the block should be written to. *Offset* references the position in the file where the block of data should be written.

Use [GetClientBuffer](#getclientbuffer-method-sftpserver-class) method to obtain the piece of data that should be written to the file.

Set *OperationStatus* to one of the below values according to the outcome of the request processing:

|  |  |  |
| --- | --- | --- |
| ostOk | 1 |  |
| ostNoSuchFile | 2 |  |
| ostAccessDenied | 3 |  |
| ostWriteProtect | 4 |  |
| ostUnsupported | 5 |  |
| ostInvalidParameter | 6 |  |
| ostEOF | 7 |  |

# 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.

The following fields are available:

- [AsyncDocumentID](#ExternalCrypto_f_AsyncDocumentID)

- [CustomParams](#ExternalCrypto_f_CustomParams)

- [Data](#ExternalCrypto_f_Data)

- [ExternalHashCalculation](#ExternalCrypto_f_ExternalHashCalculation)

- [HashAlgorithm](#ExternalCrypto_f_HashAlgorithm)

- [KeyID](#ExternalCrypto_f_KeyID)

- [KeySecret](#ExternalCrypto_f_KeySecret)

- [Method](#ExternalCrypto_f_Method)

- [Mode](#ExternalCrypto_f_Mode)

- [PublicKeyAlgorithm](#ExternalCrypto_f_PublicKeyAlgorithm)

## Fields

 **AsyncDocumentID** *String*
*Default Value: ""*

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 the pre-signing (SignAsyncBegin) and completion (SignAsyncEnd) stages.

 **CustomParams** *String*
*Default Value: ""*

Custom parameters to be passed to the signing service (uninterpreted).

 **Data** *String*
*Default Value: ""*

Additional data to be included in the async state and mirrored back by the requestor.

 **ExternalHashCalculation** *boolean*
*Default Value: False*

Specifies whether the message hash is to be calculated at the external endpoint. Please note that this mode is not supported by the DCAuth class.

If set to true, the class will pass a few kilobytes of to-be-signed data from the document to the OnExternalSign event. This only applies when SignExternal() is called.

 **HashAlgorithm** *String*
*Default Value: "SHA256"*

Specifies the request's signature hash algorithm.

|  |  |  |
| --- | --- | --- |
| SB_HASH_ALGORITHM_SHA1 | SHA1 |  |
| SB_HASH_ALGORITHM_SHA224 | SHA224 |  |
| SB_HASH_ALGORITHM_SHA256 | SHA256 |  |
| SB_HASH_ALGORITHM_SHA384 | SHA384 |  |
| SB_HASH_ALGORITHM_SHA512 | SHA512 |  |
| SB_HASH_ALGORITHM_MD2 | MD2 |  |
| SB_HASH_ALGORITHM_MD4 | MD4 |  |
| SB_HASH_ALGORITHM_MD5 | MD5 |  |
| SB_HASH_ALGORITHM_RIPEMD160 | RIPEMD160 |  |
| SB_HASH_ALGORITHM_CRC32 | CRC32 |  |
| SB_HASH_ALGORITHM_SSL3 | SSL3 |  |
| SB_HASH_ALGORITHM_GOST_R3411_1994 | GOST1994 |  |
| SB_HASH_ALGORITHM_WHIRLPOOL | WHIRLPOOL |  |
| SB_HASH_ALGORITHM_POLY1305 | POLY1305 |  |
| SB_HASH_ALGORITHM_SHA3_224 | SHA3_224 |  |
| SB_HASH_ALGORITHM_SHA3_256 | SHA3_256 |  |
| SB_HASH_ALGORITHM_SHA3_384 | SHA3_384 |  |
| SB_HASH_ALGORITHM_SHA3_512 | SHA3_512 |  |
| SB_HASH_ALGORITHM_BLAKE2S_128 | BLAKE2S_128 |  |
| SB_HASH_ALGORITHM_BLAKE2S_160 | BLAKE2S_160 |  |
| SB_HASH_ALGORITHM_BLAKE2S_224 | BLAKE2S_224 |  |
| SB_HASH_ALGORITHM_BLAKE2S_256 | BLAKE2S_256 |  |
| SB_HASH_ALGORITHM_BLAKE2B_160 | BLAKE2B_160 |  |
| SB_HASH_ALGORITHM_BLAKE2B_256 | BLAKE2B_256 |  |
| SB_HASH_ALGORITHM_BLAKE2B_384 | BLAKE2B_384 |  |
| SB_HASH_ALGORITHM_BLAKE2B_512 | BLAKE2B_512 |  |
| SB_HASH_ALGORITHM_SHAKE_128 | SHAKE_128 |  |
| SB_HASH_ALGORITHM_SHAKE_256 | SHAKE_256 |  |
| SB_HASH_ALGORITHM_SHAKE_128_LEN | SHAKE_128_LEN |  |
| SB_HASH_ALGORITHM_SHAKE_256_LEN | SHAKE_256_LEN |  |

 **KeyID** *String*
*Default Value: ""*

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 an extra protection layer for the protocol and diminishes the risk of the private key becoming abused by foreign parties. Use this property to provide the pre-shared key identifier, and use [KeySecret](#ExternalCrypto_f_KeySecret) 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:

```text
  signer.ExternalCrypto.KeyID = "MainSigningKey";
  signer.ExternalCrypto.KeySecret = "abcdef0123456789";
```

 **KeySecret** *String*
*Default Value: ""*

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.

Read more about configuring authentication in the [KeyID](#ExternalCrypto_f_KeyID) topic.

 **Method** *int*
*Default Value: 0*

Specifies the asynchronous signing method. This is typically defined by the DC server capabilities and setup.

Available options:

|  |  |
| --- | --- |
| asmdPKCS1 | 0 |
| asmdPKCS7 | 1 |

 **Mode** *int*
*Default Value: 0*

Specifies the external cryptography mode.

Available options:

|  |  |
| --- | --- |
| ecmDefault | The default value (0) |
| ecmDisabled | Do not use DC or external signing (1) |
| ecmGeneric | Generic external signing with the OnExternalSign event (2) |
| ecmDCAuth | DCAuth signing (3) |
| ecmDCAuthJSON | DCAuth signing in JSON format (4) |

 **PublicKeyAlgorithm** *String*
*Default Value: ""*

Provide the public key algorithm here if the certificate is not available on the pre-signing stage.

|  |  |  |
| --- | --- | --- |
| SB_CERT_ALGORITHM_ID_RSA_ENCRYPTION | rsaEncryption |  |
| SB_CERT_ALGORITHM_MD2_RSA_ENCRYPTION | md2withRSAEncryption |  |
| SB_CERT_ALGORITHM_MD5_RSA_ENCRYPTION | md5withRSAEncryption |  |
| SB_CERT_ALGORITHM_SHA1_RSA_ENCRYPTION | sha1withRSAEncryption |  |
| SB_CERT_ALGORITHM_ID_DSA | id-dsa |  |
| SB_CERT_ALGORITHM_ID_DSA_SHA1 | id-dsa-with-sha1 |  |
| SB_CERT_ALGORITHM_DH_PUBLIC | dhpublicnumber |  |
| SB_CERT_ALGORITHM_SHA224_RSA_ENCRYPTION | sha224WithRSAEncryption |  |
| SB_CERT_ALGORITHM_SHA256_RSA_ENCRYPTION | sha256WithRSAEncryption |  |
| SB_CERT_ALGORITHM_SHA384_RSA_ENCRYPTION | sha384WithRSAEncryption |  |
| SB_CERT_ALGORITHM_SHA512_RSA_ENCRYPTION | sha512WithRSAEncryption |  |
| SB_CERT_ALGORITHM_ID_RSAPSS | id-RSASSA-PSS |  |
| SB_CERT_ALGORITHM_ID_RSAOAEP | id-RSAES-OAEP |  |
| SB_CERT_ALGORITHM_RSASIGNATURE_RIPEMD160 | ripemd160withRSA |  |
| SB_CERT_ALGORITHM_ID_ELGAMAL | elGamal |  |
| SB_CERT_ALGORITHM_SHA1_ECDSA | ecdsa-with-SHA1 |  |
| SB_CERT_ALGORITHM_RECOMMENDED_ECDSA | ecdsa-recommended |  |
| SB_CERT_ALGORITHM_SHA224_ECDSA | ecdsa-with-SHA224 |  |
| SB_CERT_ALGORITHM_SHA256_ECDSA | ecdsa-with-SHA256 |  |
| SB_CERT_ALGORITHM_SHA384_ECDSA | ecdsa-with-SHA384 |  |
| SB_CERT_ALGORITHM_SHA512_ECDSA | ecdsa-with-SHA512 |  |
| SB_CERT_ALGORITHM_EC | id-ecPublicKey |  |
| SB_CERT_ALGORITHM_SPECIFIED_ECDSA | ecdsa-specified |  |
| SB_CERT_ALGORITHM_GOST_R3410_1994 | id-GostR3410-94 |  |
| SB_CERT_ALGORITHM_GOST_R3410_2001 | id-GostR3410-2001 |  |
| SB_CERT_ALGORITHM_GOST_R3411_WITH_R3410_1994 | id-GostR3411-94-with-GostR3410-94 |  |
| SB_CERT_ALGORITHM_GOST_R3411_WITH_R3410_2001 | id-GostR3411-94-with-GostR3410-2001 |  |
| SB_CERT_ALGORITHM_SHA1_ECDSA_PLAIN | ecdsa-plain-SHA1 |  |
| SB_CERT_ALGORITHM_SHA224_ECDSA_PLAIN | ecdsa-plain-SHA224 |  |
| SB_CERT_ALGORITHM_SHA256_ECDSA_PLAIN | ecdsa-plain-SHA256 |  |
| SB_CERT_ALGORITHM_SHA384_ECDSA_PLAIN | ecdsa-plain-SHA384 |  |
| SB_CERT_ALGORITHM_SHA512_ECDSA_PLAIN | ecdsa-plain-SHA512 |  |
| SB_CERT_ALGORITHM_RIPEMD160_ECDSA_PLAIN | ecdsa-plain-RIPEMD160 |  |
| SB_CERT_ALGORITHM_WHIRLPOOL_RSA_ENCRYPTION | whirlpoolWithRSAEncryption |  |
| SB_CERT_ALGORITHM_ID_DSA_SHA224 | id-dsa-with-sha224 |  |
| SB_CERT_ALGORITHM_ID_DSA_SHA256 | id-dsa-with-sha256 |  |
| SB_CERT_ALGORITHM_SHA3_224_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-sha3-224 |  |
| SB_CERT_ALGORITHM_SHA3_256_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-sha3-256 |  |
| SB_CERT_ALGORITHM_SHA3_384_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-sha3-384 |  |
| SB_CERT_ALGORITHM_SHA3_512_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-sha3-512 |  |
| SB_CERT_ALGORITHM_SHA3_224_ECDSA | id-ecdsa-with-sha3-224 |  |
| SB_CERT_ALGORITHM_SHA3_256_ECDSA | id-ecdsa-with-sha3-256 |  |
| SB_CERT_ALGORITHM_SHA3_384_ECDSA | id-ecdsa-with-sha3-384 |  |
| SB_CERT_ALGORITHM_SHA3_512_ECDSA | id-ecdsa-with-sha3-512 |  |
| SB_CERT_ALGORITHM_SHA3_224_ECDSA_PLAIN | id-ecdsa-plain-with-sha3-224 |  |
| SB_CERT_ALGORITHM_SHA3_256_ECDSA_PLAIN | id-ecdsa-plain-with-sha3-256 |  |
| SB_CERT_ALGORITHM_SHA3_384_ECDSA_PLAIN | id-ecdsa-plain-with-sha3-384 |  |
| SB_CERT_ALGORITHM_SHA3_512_ECDSA_PLAIN | id-ecdsa-plain-with-sha3-512 |  |
| SB_CERT_ALGORITHM_ID_DSA_SHA3_224 | id-dsa-with-sha3-224 |  |
| SB_CERT_ALGORITHM_ID_DSA_SHA3_256 | id-dsa-with-sha3-256 |  |
| SB_CERT_ALGORITHM_BLAKE2S_128_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-blake2s128 |  |
| SB_CERT_ALGORITHM_BLAKE2S_160_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-blake2s160 |  |
| SB_CERT_ALGORITHM_BLAKE2S_224_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-blake2s224 |  |
| SB_CERT_ALGORITHM_BLAKE2S_256_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-blake2s256 |  |
| SB_CERT_ALGORITHM_BLAKE2B_160_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-blake2b160 |  |
| SB_CERT_ALGORITHM_BLAKE2B_256_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-blake2b256 |  |
| SB_CERT_ALGORITHM_BLAKE2B_384_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-blake2b384 |  |
| SB_CERT_ALGORITHM_BLAKE2B_512_RSA_ENCRYPTION | id-rsassa-pkcs1-v1_5-with-blake2b512 |  |
| SB_CERT_ALGORITHM_BLAKE2S_128_ECDSA | id-ecdsa-with-blake2s128 |  |
| SB_CERT_ALGORITHM_BLAKE2S_160_ECDSA | id-ecdsa-with-blake2s160 |  |
| SB_CERT_ALGORITHM_BLAKE2S_224_ECDSA | id-ecdsa-with-blake2s224 |  |
| SB_CERT_ALGORITHM_BLAKE2S_256_ECDSA | id-ecdsa-with-blake2s256 |  |
| SB_CERT_ALGORITHM_BLAKE2B_160_ECDSA | id-ecdsa-with-blake2b160 |  |
| SB_CERT_ALGORITHM_BLAKE2B_256_ECDSA | id-ecdsa-with-blake2b256 |  |
| SB_CERT_ALGORITHM_BLAKE2B_384_ECDSA | id-ecdsa-with-blake2b384 |  |
| SB_CERT_ALGORITHM_BLAKE2B_512_ECDSA | id-ecdsa-with-blake2b512 |  |
| SB_CERT_ALGORITHM_BLAKE2S_128_ECDSA_PLAIN | id-ecdsa-plain-with-blake2s128 |  |
| SB_CERT_ALGORITHM_BLAKE2S_160_ECDSA_PLAIN | id-ecdsa-plain-with-blake2s160 |  |
| SB_CERT_ALGORITHM_BLAKE2S_224_ECDSA_PLAIN | id-ecdsa-plain-with-blake2s224 |  |
| SB_CERT_ALGORITHM_BLAKE2S_256_ECDSA_PLAIN | id-ecdsa-plain-with-blake2s256 |  |
| SB_CERT_ALGORITHM_BLAKE2B_160_ECDSA_PLAIN | id-ecdsa-plain-with-blake2b160 |  |
| SB_CERT_ALGORITHM_BLAKE2B_256_ECDSA_PLAIN | id-ecdsa-plain-with-blake2b256 |  |
| SB_CERT_ALGORITHM_BLAKE2B_384_ECDSA_PLAIN | id-ecdsa-plain-with-blake2b384 |  |
| SB_CERT_ALGORITHM_BLAKE2B_512_ECDSA_PLAIN | id-ecdsa-plain-with-blake2b512 |  |
| SB_CERT_ALGORITHM_ID_DSA_BLAKE2S_224 | id-dsa-with-blake2s224 |  |
| SB_CERT_ALGORITHM_ID_DSA_BLAKE2S_256 | id-dsa-with-blake2s256 |  |
| SB_CERT_ALGORITHM_EDDSA_ED25519 | id-Ed25519 |  |
| SB_CERT_ALGORITHM_EDDSA_ED448 | id-Ed448 |  |
| SB_CERT_ALGORITHM_EDDSA_ED25519_PH | id-Ed25519ph |  |
| SB_CERT_ALGORITHM_EDDSA_ED448_PH | id-Ed448ph |  |
| SB_CERT_ALGORITHM_EDDSA | id-EdDSA |  |
| SB_CERT_ALGORITHM_EDDSA_SIGNATURE | id-EdDSA-sig |  |
| SB_CERT_ALGORITHM_MLDSA_44 | id-ml-dsa-44 |  |
| SB_CERT_ALGORITHM_MLDSA_65 | id-ml-dsa-65 |  |
| SB_CERT_ALGORITHM_MLDSA_87 | id-ml-dsa-87 |  |
| SB_CERT_ALGORITHM_HASH_MLDSA_44_SHA512 | id-hash-ml-dsa-44-with-sha512 |  |
| SB_CERT_ALGORITHM_HASH_MLDSA_65_SHA512 | id-hash-ml-dsa-65-with-sha512 |  |
| SB_CERT_ALGORITHM_HASH_MLDSA_87_SHA512 | id-hash-ml-dsa-87-with-sha512 |  |
| SB_CERT_ALGORITHM_MLKEM_512 | id-ml-kem-512 |  |
| SB_CERT_ALGORITHM_MLKEM_768 | id-ml-kem-768 |  |
| SB_CERT_ALGORITHM_MLKEM_1024 | id-ml-kem-1024 |  |

## Constructors

```text
public ExternalCrypto();
```

 Creates a new ExternalCrypto object with default field values.

# FTPListEntry Type

Represents a basic container for the remote file details.

## Remarks

The class represents the details of a file entry returned by the FTP server.

The following fields are available:

- [AccessTime](#FTPListEntry_f_AccessTime)

- [CreationTime](#FTPListEntry_f_CreationTime)

- [EntryFormat](#FTPListEntry_f_EntryFormat)

- [FileType](#FTPListEntry_f_FileType)

- [ModificationTime](#FTPListEntry_f_ModificationTime)

- [Name](#FTPListEntry_f_Name)

- [Path](#FTPListEntry_f_Path)

- [Principal](#FTPListEntry_f_Principal)

- [Size](#FTPListEntry_f_Size)

- [UnixPerms](#FTPListEntry_f_UnixPerms)

- [UnparsedName](#FTPListEntry_f_UnparsedName)

## Fields

 **AccessTime** *String*
*Default Value: ""*

Contains the last access time for this file, in UTC.

 **CreationTime** *String*
*Default Value: ""*

Contains this file's creation time, in UTC.

 **EntryFormat** *int*
*Default Value: 0*

The file listing format:

|  |  |
| --- | --- |
| cfefUnknown | 0 |
| cfefUnix | 1 |
| cfefWindows | 2 |
| cfefMLSD | 3 |

 **FileType** *int*
*Default Value: 0*

The type of the entry:

|  |  |
| --- | --- |
| fetUnknown | 0 |
| fetDirectory | 1 |
| fetFile | 2 |
| fetSymlink | 3 |
| fetSpecial | 4 |
| fetCurrentDirectory | 5 |
| fetParentDirectory | 6 |
| fetSocket | 7 |
| fetCharDevice | 8 |
| fetBlockDevice | 9 |
| fetFIFO | 10 |

 **ModificationTime** *String*
*Default Value: ""*

File last modification date/time.

 **Name** *String*
*Default Value: ""*

The file or directory name.

 **Path** *String*
*Default Value: ""*

The full path to the file or directory.

 **Principal** *String*
*Default Value: ""*

Specifies the owner of the file/directory.

Note: in earlier versions this property was called Owner. It was renamed to Principal to avoid clashes with certain SDK namings.

 **Size** *long*
*Default Value: 0*

File size in bytes.

 **UnixPerms** *int*
*Default Value: 511*

The file Unix permissions bit mask (e.g. rwxrwxrwx=511 (0777); rwxr--r--=484 (0744)).

 **UnparsedName** *String*
*Default Value: ""*

The unparsed entry as returned by the server. Sometimes this is also known as "long name".

## Constructors

```text
public FTPListEntry();
```

 Creates a new FTPListEntry object.

# SocketSettings Type

A container for the socket settings.

## Remarks

This type is a container for socket-layer parameters.

The following fields are available:

- [DNSMode](#SocketSettings_f_DNSMode)

- [DNSPort](#SocketSettings_f_DNSPort)

- [DNSQueryTimeout](#SocketSettings_f_DNSQueryTimeout)

- [DNSServers](#SocketSettings_f_DNSServers)

- [DNSTotalTimeout](#SocketSettings_f_DNSTotalTimeout)

- [IncomingSpeedLimit](#SocketSettings_f_IncomingSpeedLimit)

- [LocalAddress](#SocketSettings_f_LocalAddress)

- [LocalPort](#SocketSettings_f_LocalPort)

- [OutgoingSpeedLimit](#SocketSettings_f_OutgoingSpeedLimit)

- [Timeout](#SocketSettings_f_Timeout)

- [UseIPv6](#SocketSettings_f_UseIPv6)

## Fields

 **DNSMode** *int*
*Default Value: 0*

Selects the DNS resolver to use: the component's (secure) built-in one, or the one provided by the system.

|  |  |
| --- | --- |
| dmAuto | 0 |
| dmPlatform | 1 |
| dmOwn | 2 |
| dmOwnSecure | 3 |

 **DNSPort** *int*
*Default Value: 0*

Specifies the port number to be used for sending queries to the DNS server.

 **DNSQueryTimeout** *int*
*Default Value: 0*

The timeout (in milliseconds) for each DNS query. The value of 0 indicates an infinite timeout.

 **DNSServers** *String*
*Default Value: ""*

The addresses of DNS servers to use for address resolution, separated by commas or semicolons.

 **DNSTotalTimeout** *int*
*Default Value: 0*

The timeout (in milliseconds) for the whole resolution process. The value of 0 indicates an infinite timeout.

 **IncomingSpeedLimit** *int*
*Default Value: 0*

The maximum number of bytes to read from the socket, per second.

 **LocalAddress** *String*
*Default Value: ""*

The local network interface to bind the socket to.

 **LocalPort** *int*
*Default Value: 0*

The local port number to bind the socket to.

 **OutgoingSpeedLimit** *int*
*Default Value: 0*

The maximum number of bytes to write to the socket, per second.

 **Timeout** *int*
*Default Value: 60000*

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** *boolean*
*Default Value: False*

Enables or disables IP protocol version 6.

## Constructors

```text
public SocketSettings();
```

 Creates a new SocketSettings object.

# SSHConnectionInfo Type

Contains information about SSH connection.

## Remarks

SSHConnectionInfo object contains information about one SSH connection.

The following fields are available:

- [ClientKeyAlgorithm](#SSHConnectionInfo_f_ClientKeyAlgorithm)

- [ClientKeyBits](#SSHConnectionInfo_f_ClientKeyBits)

- [ClientKeyFingerprint](#SSHConnectionInfo_f_ClientKeyFingerprint)

- [CloseReason](#SSHConnectionInfo_f_CloseReason)

- [CompressionAlgorithmInbound](#SSHConnectionInfo_f_CompressionAlgorithmInbound)

- [CompressionAlgorithmOutbound](#SSHConnectionInfo_f_CompressionAlgorithmOutbound)

- [EncryptionAlgorithmInbound](#SSHConnectionInfo_f_EncryptionAlgorithmInbound)

- [EncryptionAlgorithmOutbound](#SSHConnectionInfo_f_EncryptionAlgorithmOutbound)

- [InboundEncryptionKeyBits](#SSHConnectionInfo_f_InboundEncryptionKeyBits)

- [KexAlgorithm](#SSHConnectionInfo_f_KexAlgorithm)

- [KexBits](#SSHConnectionInfo_f_KexBits)

- [KexLines](#SSHConnectionInfo_f_KexLines)

- [MacAlgorithmInbound](#SSHConnectionInfo_f_MacAlgorithmInbound)

- [MacAlgorithmOutbound](#SSHConnectionInfo_f_MacAlgorithmOutbound)

- [OutboundEncryptionKeyBits](#SSHConnectionInfo_f_OutboundEncryptionKeyBits)

- [PublicKeyAlgorithm](#SSHConnectionInfo_f_PublicKeyAlgorithm)

- [RemoteAddress](#SSHConnectionInfo_f_RemoteAddress)

- [RemotePort](#SSHConnectionInfo_f_RemotePort)

- [RemoteSoftwareName](#SSHConnectionInfo_f_RemoteSoftwareName)

- [ServerKeyAlgorithm](#SSHConnectionInfo_f_ServerKeyAlgorithm)

- [ServerKeyBits](#SSHConnectionInfo_f_ServerKeyBits)

- [ServerKeyFingerprint](#SSHConnectionInfo_f_ServerKeyFingerprint)

- [TotalBytesReceived](#SSHConnectionInfo_f_TotalBytesReceived)

- [TotalBytesSent](#SSHConnectionInfo_f_TotalBytesSent)

- [Version](#SSHConnectionInfo_f_Version)

## Fields

 **ClientKeyAlgorithm** *String (read-only)*
*Default Value: ""*

Specifies the client's key algorithm.

 **ClientKeyBits** *int (read-only)*
*Default Value: 0*

Specifies the length of the client's key.

 **ClientKeyFingerprint** *String (read-only)*
*Default Value: ""*

The fingerprint (hash value) of the client's public key.

 **CloseReason** *String (read-only)*
*Default Value: ""*

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 (read-only)*
*Default Value: ""*

Compression algorithm for the incoming traffic.

 **CompressionAlgorithmOutbound** *String (read-only)*
*Default Value: ""*

Compression algorithm for the outgoing traffic.

 **EncryptionAlgorithmInbound** *String (read-only)*
*Default Value: ""*

Encryption algorithm for the incoming traffic.

 **EncryptionAlgorithmOutbound** *String (read-only)*
*Default Value: ""*

Encryption algorithm for the outgoing traffic.

 **InboundEncryptionKeyBits** *int (read-only)*
*Default Value: 0*

Specifies the length of the key used to encrypt the incoming traffic.

 **KexAlgorithm** *String (read-only)*
*Default Value: ""*

The key exchange algorithm used during the SSH handshake.

 **KexBits** *int (read-only)*
*Default Value: 0*

The number of bits used by the key exchange algorithm.

 **KexLines** *String (read-only)*
*Default Value: ""*

The contents of the received KexInit packet.

KexInit packet contains the list of algorithms supported by the remote party.

 **MacAlgorithmInbound** *String (read-only)*
*Default Value: ""*

MAC algorithm used for the incoming connection.

 **MacAlgorithmOutbound** *String (read-only)*
*Default Value: ""*

MAC algorithm used for outbound connection.

 **OutboundEncryptionKeyBits** *int (read-only)*
*Default Value: 0*

Specifies the length of the key used to encrypt the outgoing traffic.

 **PublicKeyAlgorithm** *String (read-only)*
*Default Value: ""*

Specifies the public key algorithm which was used during the SSH handshake.

 **RemoteAddress** *String (read-only)*
*Default Value: ""*

The client's IP address.

 **RemotePort** *int (read-only)*
*Default Value: 0*

The remote port of the client connection.

 **RemoteSoftwareName** *String (read-only)*
*Default Value: ""*

Returns the name (self-advertised) of the SSH software running on the other side.

 **ServerKeyAlgorithm** *String (read-only)*
*Default Value: ""*

Specifies the server's key algorithm.

 **ServerKeyBits** *int (read-only)*
*Default Value: 0*

Specifies the number of bits in the server's key.

 **ServerKeyFingerprint** *String (read-only)*
*Default Value: ""*

The fingerprint (hash value) of the server's public key.

 **TotalBytesReceived** *long (read-only)*
*Default Value: 0*

Returns the total number of bytes received over this connection.

 **TotalBytesSent** *long (read-only)*
*Default Value: 0*

Returns the total number of bytes sent over this connection.

 **Version** *int (read-only)*
*Default Value: 2*

Specifies SSH protocol version.

## Constructors

```text
public SSHConnectionInfo();
```

 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.

The following fields are available:

- [Algorithm](#SSHKey_f_Algorithm)

- [Bits](#SSHKey_f_Bits)

- [Comment](#SSHKey_f_Comment)

- [Curve](#SSHKey_f_Curve)

- [Extractable](#SSHKey_f_Extractable)

- [FingerprintMD5](#SSHKey_f_FingerprintMD5)

- [FingerprintSHA1](#SSHKey_f_FingerprintSHA1)

- [FingerprintSHA256](#SSHKey_f_FingerprintSHA256)

- [KeyFormat](#SSHKey_f_KeyFormat)

- [KeyProtectionAlgorithm](#SSHKey_f_KeyProtectionAlgorithm)

- [Private](#SSHKey_f_Private)

- [Public](#SSHKey_f_Public)

- [Subject](#SSHKey_f_Subject)

## Fields

 **Algorithm** *String (read-only)*
*Default Value: ""*

Specifies the key algorithm.

The following key algorithms are currently supported and can be returned by this property:

- RSA
- DSS
- ECDSA
- EDDSA
- MLDSA
- ECDSA-SK
- EDDSA-SK

 **Bits** *int (read-only)*
*Default Value: 0*

The number of bits in the key: the more the better, 2048 or 4096 are typical values.

 **Comment** *String*
*Default Value: ""*

The comment for the public key.

 **Curve** *String (read-only)*
*Default Value: ""*

Specifies the elliptical curve when EC cryptography is used.

The following curves are currently supported:

- NISTP256
- NISTP384
- NISTP521
- NISTK163
- NISTP192
- NISTP224
- NISTK233
- NISTB233
- NISTK283
- NISTK409
- NISTB409
- NISTK571
- CURVE25519 (EdDSA curve)
- CURVE448 (EdDSA curve)

 **Extractable** *boolean (read-only)*
*Default Value: False*

Whether the key is extractable (e.g., from a security token), or not.

 **FingerprintMD5** *String (read-only)*
*Default Value: ""*

Contains the MD5 fingerprint (hash) of the key.

 **FingerprintSHA1** *String (read-only)*
*Default Value: ""*

Contains the SHA-1 fingerprint (hash) of the key.

 **FingerprintSHA256** *String (read-only)*
*Default Value: ""*

Contains the SHA-256 fingerprint (hash) of the key.

 **KeyFormat** *int (read-only)*
*Default Value: 0*

Specifies the format in which the key is stored.

|  |  |  |
| --- | --- | --- |
| ckfOpenSSH | 0 |  |
| ckfOpenSSH2 | 1 |  |
| ckfIETF | 2 |  |
| ckfPuTTY | 3 |  |
| ckfX509 | 4 |  |
| ckfBinary | 5 |  |
| ckfSSH1 | 6 |  |
| ckfPGP | 7 |  |
| ckfPKCS8 | 8 |  |
| ckfPuTTY3 | 9 |  |
| ckfOpenSSHCert | 10 |  |

 **KeyProtectionAlgorithm** *String (read-only)*
*Default Value: ""*

Specifies the key protection algorithm.

 **Private** *boolean (read-only)*
*Default Value: False*

Whether this key is a private key or not.

 **Public** *boolean (read-only)*
*Default Value: False*

Whether this key is a public key or not.

 **Subject** *String*
*Default Value: ""*

Specifies the public key owner (subject). This property is used only for IETF-keys.

## Constructors

```text
public SSHKey(byte[] bytes, int startIndex, int count, String password);
```

 Loads private key from the * Bytes * buffer. Parameters * StartIndex * and * Count * specify the starting index of the key data and its length, correspondingly. Provide a * Password * to decrypt the key.

```text
public SSHKey(byte[] bytes, int startIndex, int count);
```

 Loads public key from the * Bytes * buffer. Parameters * StartIndex * and * Count * specify the starting index of the key data and its length, correspondingly.

```text
public SSHKey(java.io.InputStream stream, String password);
```

 Loads private key from the stream. Provide a * Password * to decrypt the key.

```text
public SSHKey(java.io.InputStream stream);
```

 Loads public key from the stream.

```text
public SSHKey(String path, String password);
```

 Loads private key from the file. Provide a * Path * to the file and * Password * to decrypt the key.

```text
public SSHKey(String path);
```

 Loads public key from the file specified by * Path * .

```text
public SSHKey();
```

 Creates a new key.

# SSHSettings Type

A container for various SSH protocol settings.

## Remarks

SSHSettings stores various settings of SSH client or server.

The following fields are available:

- [AutoAdjustCiphers](#SSHSettings_f_AutoAdjustCiphers)

- [BaseConfiguration](#SSHSettings_f_BaseConfiguration)

- [CompressionAlgorithms](#SSHSettings_f_CompressionAlgorithms)

- [CompressionLevel](#SSHSettings_f_CompressionLevel)

- [DefaultWindowSize](#SSHSettings_f_DefaultWindowSize)

- [EncryptionAlgorithms](#SSHSettings_f_EncryptionAlgorithms)

- [ForceCompression](#SSHSettings_f_ForceCompression)

- [ForwardAuthAgent](#SSHSettings_f_ForwardAuthAgent)

- [GSSAuthTypes](#SSHSettings_f_GSSAuthTypes)

- [GSSDelegateCreds](#SSHSettings_f_GSSDelegateCreds)

- [GSSHostname](#SSHSettings_f_GSSHostname)

- [GSSLib](#SSHSettings_f_GSSLib)

- [GSSMechanisms](#SSHSettings_f_GSSMechanisms)

- [GSSProtocols](#SSHSettings_f_GSSProtocols)

- [HandshakeTimeout](#SSHSettings_f_HandshakeTimeout)

- [KexAlgorithms](#SSHSettings_f_KexAlgorithms)

- [MacAlgorithms](#SSHSettings_f_MacAlgorithms)

- [MaxSSHPacketSize](#SSHSettings_f_MaxSSHPacketSize)

- [MinWindowSize](#SSHSettings_f_MinWindowSize)

- [ObfuscateHandshake](#SSHSettings_f_ObfuscateHandshake)

- [ObfuscationPassword](#SSHSettings_f_ObfuscationPassword)

- [PublicKeyAlgorithms](#SSHSettings_f_PublicKeyAlgorithms)

- [RequestPasswordChange](#SSHSettings_f_RequestPasswordChange)

- [SoftwareName](#SSHSettings_f_SoftwareName)

- [TrustAllKeys](#SSHSettings_f_TrustAllKeys)

- [UseAuthAgent](#SSHSettings_f_UseAuthAgent)

- [Versions](#SSHSettings_f_Versions)

## Fields

 **AutoAdjustCiphers** *boolean*
*Default Value: True*

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** *int*
*Default Value: 0*

Allows to choose base configuration of SSH settings, tuned up for different purposes such as high security or higher compatibility.

 **CompressionAlgorithms** *String*
*Default Value: ""*

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:

- none
- zlib
- zlib@openssh.com

 **CompressionLevel** *int*
*Default Value: 6*

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** *int*
*Default Value: 2048000*

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*
*Default Value: ""*

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:

- 3des-cbc
- blowfish-cbc
- twofish256-cbc
- twofish192-cbc
- twofish128-cbc
- aes256-cbc
- aes192-cbc
- aes128-cbc
- serpent256-cbc
- serpent192-cbc
- serpent128-cbc
- arcfour
- idea-cbc
- cast128-cbc
- none
- des-cbc
- aes128-ctr
- aes192-ctr
- aes256-ctr
- 3des-ctr
- blowfish-ctr
- twofish128-ctr
- twofish192-ctr
- twofish256-ctr
- serpent128-ctr
- serpent192-ctr
- serpent256-ctr
- idea-ctr
- cast128-ctr
- arcfour128
- arcfour256
- aes128-gcm
- aes256-gcm
- aes128-gcm@openssh.com
- aes256-gcm@openssh.com
- chacha20-poly1305
- chacha20-poly1305@openssh.com

 **ForceCompression** *boolean*
*Default Value: False*

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.

 **ForwardAuthAgent** *boolean*
*Default Value: False*

Enables or disables auth agent forwarding. This allows the class to connect to the second and subsequent servers in the chain with the key agent available on the client computer.

 **GSSAuthTypes** *String*
*Default Value: ""*

A comma-separated list of authentication types. Two types are currently supported: gssapi-with-mic and gssapi-keyex.

 **GSSDelegateCreds** *boolean*
*Default Value: False*

Switches credential delegation on or off.

 **GSSHostname** *String*
*Default Value: ""*

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*
*Default Value: ""*

A path to the GSS-API library (DLL or SO).

 **GSSMechanisms** *String*
*Default Value: ""*

A comma-separated list of GSS mechanisms to use. Two values are currently supported: lib and SSPI.

 **GSSProtocols** *String*
*Default Value: ""*

A comma-separated list of SSPI protocols. Two protocols are currently supported: kerberos and NTLM.

 **HandshakeTimeout** *int*
*Default Value: 45*

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*
*Default Value: ""*

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:

- diffie-hellman-group-exchange-sha1
- diffie-hellman-group1-sha1
- diffie-hellman-group14-sha1
- diffie-hellman-group-exchange-sha256
- rsa1024-sha1
- rsa2048-sha256
- ecdh-sha2-nistp256
- ecdh-sha2-nistp384
- ecdh-sha2-nistp521
- ecdh-sha2-nistk163
- ecdh-sha2-nistp192
- ecdh-sha2-nistp224
- ecdh-sha2-nistk233
- ecdh-sha2-nistb233
- ecdh-sha2-nistk283
- ecdh-sha2-nistk409
- ecdh-sha2-nistb409
- ecdh-sha2-nistt571
- ecdh-sha2-curve25519
- curve25519-sha256@libssh.org
- curve448-sha512@libssh.org
- diffie-hellman-group14-sha256
- diffie-hellman-group15-sha512
- diffie-hellman-group16-sha512
- diffie-hellman-group17-sha512
- diffie-hellman-group18-sha512

 **MacAlgorithms** *String*
*Default Value: ""*

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:

- hmac-sha1
- hmac-sha1-96
- hmac-md5
- hmac-md5-96
- none
- hmac-ripemd160
- hmac-ripemd
- hmac-ripemd160@openssh.com
- hmac-sha256@ssh.com
- hmac-sha256-96@ssh.com
- umac-32@openssh.com
- umac-64@openssh.com
- umac-96@openssh.com
- umac-128@openssh.com
- hmac-sha2-256
- hmac-sha2-512
- aes128-gcm
- aes256-gcm
- chacha20-poly1305@openssh.com
- hmac-sha2-256-etm@openssh.com
- hmac-sha2-512-etm@openssh.com

 **MaxSSHPacketSize** *int*
*Default Value: 262144*

Specifies the maximum length of one SSH packet in bytes.

 **MinWindowSize** *int*
*Default Value: 2048*

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** *boolean*
*Default Value: False*

Enables or disables handshake obfuscation.

 **ObfuscationPassword** *String*
*Default Value: ""*

Specifies the password used to encrypt the handshake when ObfuscateHandshake is set.

 **PublicKeyAlgorithms** *String*
*Default Value: ""*

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:

- ssh-dss
- ssh-rsa
- x509v3-sign-rsa
- x509v3-sign-dss
- spki-sign-rsa,
- spki-sign-dss
- pgp-sign-rsa
- pgp-sign-dss
- ecdsa-sha2-nistp256
- ecdsa-sha2-nistp384
- ecdsa-sha2-nistp521
- ecdsa-sha2-nistk163
- ecdsa-sha2-nistp192
- ecdsa-sha2-nistp224
- ecdsa-sha2-nistk233
- ecdsa-sha2-nistb233
- ecdsa-sha2-nistk283
- ecdsa-sha2-nistk409
- ecdsa-sha2-nistb409
- ecdsa-sha2-nistt571,
- ecdsa-sha2-curve25519
- x509v3-ssh-rsa
- x509v3-ssh-dss
- x509v3-rsa2048-sha256
- x509v3-ecdsa-sha2-nistp256
- x509v3-ecdsa-sha2-nistp384
- x509v3-ecdsa-sha2-nistp521
- x509v3-ecdsa-sha2-nistk163
- x509v3-ecdsa-sha2-nistp192
- x509v3-ecdsa-sha2-nistp224
- x509v3-ecdsa-sha2-nistk233
- x509v3-ecdsa-sha2-nistb233
- x509v3-ecdsa-sha2-nistk283
- x509v3-ecdsa-sha2-nistk409
- x509v3-ecdsa-sha2-nistb409
- x509v3-ecdsa-sha2-nistt571
- x509v3-ecdsa-sha2-curve25519
- ssh-ed25519
- ssh-ed448
- rsa-sha2-256
- rsa-sha2-512

 **RequestPasswordChange** *boolean*
*Default Value: False*

Whether to request a password change when connecting.

 **SoftwareName** *String*
*Default Value: "SecureBlackbox"*

The name to be used by the component to identify itself.

 **TrustAllKeys** *boolean*
*Default Value: False*

Enables or disables explicit trust to all server keys. Use with care.

 **UseAuthAgent** *boolean*
*Default Value: False*

Enables or disables the use of external key agent, such as Putty key agent.

 **Versions** *int*
*Default Value: 1*

Specifies enabled SSH protocol versions (1 or 2).

## Constructors

```text
public SSHSettings();
```

 Creates a new object with default settings.

# UserAccount Type

A container for user account information.

## Remarks

UserAccount objects are used to store user account information, such as logins and passwords.

The following fields are available:

- [AssociatedData](#UserAccount_f_AssociatedData)

- [BasePath](#UserAccount_f_BasePath)

- [Certificate](#UserAccount_f_Certificate)

- [Data](#UserAccount_f_Data)

- [Email](#UserAccount_f_Email)

- [HashAlgorithm](#UserAccount_f_HashAlgorithm)

- [IncomingSpeedLimit](#UserAccount_f_IncomingSpeedLimit)

- [OtpAlgorithm](#UserAccount_f_OtpAlgorithm)

- [OTPLen](#UserAccount_f_OTPLen)

- [OtpValue](#UserAccount_f_OtpValue)

- [OutgoingSpeedLimit](#UserAccount_f_OutgoingSpeedLimit)

- [Password](#UserAccount_f_Password)

- [SharedSecret](#UserAccount_f_SharedSecret)

- [SSHKey](#UserAccount_f_SSHKey)

- [Username](#UserAccount_f_Username)

## Fields

 **AssociatedData** *byte[]*
*Default Value: ""*

Contains the user's Associated Data when SSH AEAD (Authenticated Encryption with Associated Data) algorithm is used.

 **BasePath** *String*
*Default Value: ""*

Base path for this user in the server's file system.

 **Certificate** *byte[]*
*Default Value: ""*

Contains the user's certificate.

 **Data** *String*
*Default Value: ""*

Contains uninterpreted user-defined data that should be associated with the user account, such as comments or custom settings.

 **Email** *String*
*Default Value: ""*

The user's email address.

 **HashAlgorithm** *String*
*Default Value: ""*

Specifies the hash algorithm used to generate TOTP (Time-based One-Time Passwords) passwords for this user. Three HMAC algorithms are supported, with SHA-1, SHA-256, and SHA-512 digests:

|  |  |  |
| --- | --- | --- |
| SB_MAC_ALGORITHM_HMAC_SHA1 | SHA1 |  |
| SB_MAC_ALGORITHM_HMAC_SHA256 | SHA256 |  |
| SB_MAC_ALGORITHM_HMAC_SHA512 | SHA512 |  |

 **IncomingSpeedLimit** *int*
*Default Value: 0*

Specifies the incoming speed limit for this user. The value of 0 (zero) means "no limitation".

 **OtpAlgorithm** *int*
*Default Value: 0*

The algorithm used to generate one-time passwords (OTP) for this user, either HOTP (Hash-based OTP) or TOTP (Time-based OTP). In the former case, a value of a dedicated counter is used to generate a unique password, while in the latter the password is generated on the basis of the current time value.

|  |  |  |
| --- | --- | --- |
| oaHmac | 0 |  |
| oaTime | 1 |  |

 **OTPLen** *int*
*Default Value: 0*

Specifies the length of the user's OTP password.

 **OtpValue** *int*
*Default Value: 0*

The user's time interval (TOTP) or Counter (HOTP).

 **OutgoingSpeedLimit** *int*
*Default Value: 0*

Specifies the outgoing speed limit for this user. The value of 0 (zero) means "no limitation".

 **Password** *String*
*Default Value: ""*

The user's authentication password.

 **SharedSecret** *byte[]*
*Default Value: ""*

Contains the user's secret key, which is essentially a shared secret between the client and server.

Shared secrets can be used in TLS-driven protocols, as well as in OTP (where it is called a 'key secret') for generating one-time passwords on one side, and validate them on the other.

 **SSHKey** *byte[]*
*Default Value: ""*

Contains the user's SSH key.

 **Username** *String*
*Default Value: ""*

The registered name (login) of the user.

## Constructors

```text
public UserAccount();
```

 Creates a new UserAccount object

# Config Settings ([SFTPServer](#sftpserver-class) Class)

 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](#config-method-sftpserver-class) method.

### SFTPServer Config Settings

**AllAlgorithms**: Returns the list of algorithms enabled in the component.Use this configuration setting to obtain the list of algorithms currently enabled in the component in the *kexinit* format.

**AsyncDataWindowManagement**: TBD.TBD

**AuthMode**: Controls dual/multi-type authentication mode.Use this setting to adjust dual/multi-step authentication mode. The value of 0 indicates that either of supported authentication methods is sufficient to authenticate the user ("any of"). The value of 1 specifies that the user should pass all the enabled methods to authenticate themselves (MFA, or "all of").

**AutoGenerateLongNames**: TBD.TBD

**Banner[i]**: TBD.TBD

**BannerSendStage**: TBD.TBD

**CloseIfNoActiveTunnels**: TBD.TBD

**CommandModeEnabled**: TBD.TBD

**CompressionAlgorithms**: Returns the list of compression algorithms enabled in the component.Use this configuration setting to get the list of compression algorithms currently enabled in the component, as a respective *kexinit* block line.

**CustomDHGroupIndex**: Sets a specific Diffie-Hellman group index to enforce.Use this property to specify a specific DH group index to enforce for key exchange. The value of -1 enables automatic group selection, and any value between 0 and 227 specifies a particular DH group supported by SecureBlackbox. This is largely a debug setting, use it with extreme care.

**DefBanner**: TBD.TBD

**DefLanguageTag**: TBD.TBD

**DualStack**: Allows the use of ip4 and ip6 simultaneously.This setting specifies a socket can use ip4 and ip6 simultaneously.

**EncryptionAlgorithms**: Returns the list of encryption algorithms enabled in the component.Use this configuration setting to get the list of symmetric encryption algorithms currently enabled in the component, as a respective *kexinit* block line.

**KexAlgorithms**: Returns the list of key exchange algorithms enabled in the component.Use this configuration setting to get the list of key exchange algorithms currently enabled in the component, as a respective *kexinit* block line.

**LanguageTag[i]**: TBD.TBD

**MacAlgorithms**: Returns the list of MAC algorithms enabled in the component.Use this configuration setting to get the list of MAC algorithms currently enabled in the component, as a respective *kexinit* block line.

**MaxDHGroupSize**: Sets the maximal Diffie-Hellman group size.This property specifies the maximal DH group size, in bits. The larger the group size, the strong the key, however, longer groups put extra burden on the computational resources. SecureBlackbox supports groups between 1024 and 8192 bits. The default value is 8192.

**MinDHGroupSize**: Sets the minimal Diffie-Hellman group size.This property specifies the minimal DH group size, in bits. The larger the group size, the strong the key, however, longer groups put extra burden on the computational resources. SecureBlackbox supports groups between 1024 and 8192 bits. The default value is 2048.

**NotifyOnFileOperations**: Enables low-level file operation notifications.If set, the component will report low-level file operations, such as Open, Read, Write, and Close, via its Notification event.

**PublicKeyAlgorithms**: Returns the list of public key algorithms enabled in the component.Use this configuration setting to get the list of public key algorithms currently enabled in the component, as a respective *kexinit* block line.

**RefreshUsers**: Enables or disables real-time propagation of user information.Set this property to true to make the content of the Users property propagate to the server immediately. The default setting is false, which delays the effect of any changes in the Users setting until the server is restarted.

**SFTPModeEnabled**: TBD.TBD

**ShellModeEnabled**: TBD.TBD

**UseStrictKeyExchange**: Specifies how strict key exchange is supported.This setting controls whether strict key exchange (strict kex) is enabled to mitigate the Terrapin attack. When enabled, the class will indicate support for strict key exchange by automatically including the pseudo-algorithm *kex-strict-c-v00@openssh.com* for client classes and *kex-strict-s-v00@openssh.com* for server classes in the list of supported key exchange algorithms.

Since both client and server must implement strict key exchange to effectively mitigate the Terrapin attack, the class provides options to further control the behavior in different scenarios. Possible values for this setting are:

|  |  |
| --- | --- |
| 0 | Disabled. Strict key exchange is not supported in the class. |
| 1 (default) | Enabled, but not enforced. This setting enables strict key exchange, but if the remote host does not support strict key exchange the connection is still allowed to continue. |
| 2 | Enabled, but reject affected algorithms if the remote host does not support strict key exchange. If the remote host supports strict key exchange all algorithms may be used. If the remote host does not support strict key exchange the connection will only continue if the selected encryption and MAC algorithms are not affected by the Terrapin attack. |
| 3 | Required. If the remote host does not support strict key exchange the connection will fail. |

### Base Config Settings

**ASN1UseGlobalTagCache**: Controls whether ASN.1 module should use a global object cache.This is a performance setting. It is unlikely that you will ever need to adjust it.

**AssignSystemSmartCardPins**: Specifies whether CSP-level PINs should be assigned to CNG keys.This is a low-level tweak for certain cryptographic providers. It is unlikely that you will ever need to adjust it.

**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:

|  |  |  |
| --- | --- | --- |
| off |  | No caching (default) |
| local |  | Local caching |
| global |  | Global caching |

**Cookies**: Gets or sets local cookies for the class.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.

**DNSLocalSuffix**: The suffix to assign for TLD names.Use this global setting to adjust the default suffix to assign to top-level domain names. The default is *.local*.

**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.

**EnableSSHMLKEM**: Enables support for ML-KEM/hybrid key exchange algorithms in SSH client and server components.Use this setting to enable hybrid key exchange algorithms in client and server SSH and SFTP components. This is a global setting that enables ML-KEM blanketly in all SSH-dependent components.

**EnableTLSMLKEM**: Enables support for ML-KEM and hybrid groups in TLS client and server components.Use this setting to enable ML-KEM and hybrid key exchange groups in client and server TLS components. This is a global setting that enables ML-KEM blanketly in all TLS-dependent components.

**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".

**HardwareCryptoUsePolicy**: The hardware crypto usage policy.This global setting controls the hardware cryptography usage policy.

Supported Values:

|  |  |
| --- | --- |
| auto | Use hardware cryptography if available; otherwise, fall back to software-based cryptography (default). |
| enable | Always attempt to use hardware cryptography. If unavailable, exception will be thrown. |
| disable | Do not use hardware cryptography. |

**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.

**HttpVersion**: The HTTP version to use in any inner HTTP client components created.Set this property to 1.0 or 1.1 to indicate the HTTP version that any internal HTTP clients should use.

**IgnoreExpiredMSCTLSigningCert**: Whether to tolerate the expired Windows Update signing certificate.It is not uncommon for Microsoft Windows Update Certificate Trust List to be signed with an expired Microsoft certificate. Setting this global property to true makes SBB ignore the expired factor and take the Trust List into account.

**ListDelimiter**: The delimiter character for multi-element lists.Allows to set the delimiter for any multi-entry values returned by the component as a string object, such as file lists. For most of the components, this property is set to a newline sequence.

**LogDestination**: Specifies the debug log destination.Contains a comma-separated list of values that specifies where debug log should be dumped.

Supported values are:

|  |  |  |
| --- | --- | --- |
| file |  | File |
| console |  | Console |
| systemlog |  | System Log (supported for Android only) |
| debugger |  | Debugger (supported for VCL for Windows and .Net) |

**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:

|  |  |  |
| --- | --- | --- |
| time |  | Current time |
| level |  | Level |
| package |  | Package name |
| module |  | Module name |
| class |  | Class name |
| method |  | Method name |
| threadid |  | Thread Id |
| contenttype |  | Content type |
| content |  | Content |
| all |  | All details |

**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:

|  |  |  |
| --- | --- | --- |
| exclude-package |  | Exclude a package specified in the value |
| exclude-module |  | Exclude a module specified in the value |
| exclude-class |  | Exclude a class specified in the value |
| exclude-method |  | Exclude a method specified in the value |
| include-package |  | Include a package specified in the value |
| include-module |  | Include a module specified in the value |
| include-class |  | Include a class specified in the value |
| include-method |  | Include a method specified in the value |

**LogFlushMode**: Specifies the log flush mode.Use this property to set the log flush mode. The following values are defined:

|  |  |  |
| --- | --- | --- |
| none |  | No flush (caching only) |
| immediate |  | Immediate flush (real-time logging) |
| maxcount |  | Flush cached entries upon reaching LogMaxEventCount entries in the cache. |

**LogLevel**: Specifies the debug log level.Use this property to provide the desired debug log level.

Supported values are:

|  |  |  |
| --- | --- | --- |
| none |  | None (by default) |
| fatal |  | Severe errors that cause premature termination. |
| error |  | Other runtime errors or unexpected conditions. |
| warning |  | Use of deprecated APIs, poor use of API, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". |
| info |  | Interesting runtime events (startup/shutdown). |
| debug |  | Detailed information on flow of through the system. |
| trace |  | More detailed information. |

**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:

|  |  |  |
| --- | --- | --- |
| none |  | No rotation |
| deleteolder |  | Delete older entries from the cache upon reaching LogMaxEventCount |
| keepolder |  | Keep older entries in the cache upon reaching LogMaxEventCount (newer entries are discarded) |

**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.

**OldClientSideRSAFallback**: Specifies whether the SSH client should use a SHA1 fallback.Tells the SSH client to use a legacy ssh-rsa authentication even if the server indicates support for newer algorithms, such as rsa-sha-256. This is a backward-compatibility tweak.

**PKICache**: Specifies which PKI elements (certificates, CRLs, OCSP responses) should be cached.The PKICache setting specifies which Public Key Infrastructure (PKI) elements should be cached to optimize performance and reduce retrieval times. It supports comma-separated values to indicate the specific types of PKI data that should be cached.

Supported Values:

|  |  |
| --- | --- |
| certificate | Enables caching of certificates. |
| crl | Enables caching of Certificate Revocation Lists (CRLs). |
| ocsp | Enables caching of OCSP (Online Certificate Status Protocol) responses. |

Example (default value):

```text
PKICache=certificate,crl,ocsp
```

 In this example, the component caches certificates, CRLs, and OCSP responses.

**PKICachePath**: Specifies the file system path where cached PKI data is stored.The PKICachePath setting defines the file system path where cached PKI data (e.g., certificates, CRLs, OCSP responses and Trusted Lists) will be stored. This allows the system to persistently save and retrieve PKI cache data, even across application restarts.

The default value is an empty string - no cached PKI data is stored on disk.

Example:

```text
PKICachePath=C:\Temp\cache
```

 In this example, the cached PKI data is stored in the C:\Temp\cache directory.

**ProductVersion**: Returns the version of the SecureBlackbox library.This property returns the long version string of the SecureBlackbox library being used (major.minor.build.revision).

**ServerSSLDHKeyLength**: Sets the size of the TLS DHE key exchange group.Use this property to adjust the length, in bits, of the DHE prime to be used by the TLS server.

**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:

|  |  |  |
| --- | --- | --- |
| none |  | No static DNS rules (default) |
| local |  | Local static DNS rules |
| global |  | Global static DNS rules |

**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 divided 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.

**TLSSessionGroup**: Specifies the group name of TLS sessions to be used for session resumption.Use this property to limit the search of cached TLS sessions to the specified group. Sessions from other groups will be ignored. By default, all sessions are cached with an empty group name and available to all the classes.

**TLSSessionLifetime**: Specifies lifetime in seconds of the cached TLS session.Use this property to specify how much time the TLS session should be kept in the session cache. After this time, the session expires and will be automatically removed from the cache. Default value is 300 seconds (5 minutes).

**TLSSessionPurgeInterval**: Specifies how often the session cache should remove the expired TLS sessions.Use this property to specify the time interval of purging the expired TLS sessions from the session cache. Default value is 60 seconds (1 minute).

**UseCRLObjectCaching**: Specifies whether reuse of loaded CRL objects is enabled.This setting enables or disables the caching of CRL objects. When set to true (the default value), the system checks if a CRL object is already loaded in memory before attempting to load a new instance. If the object is found, the existing instance is reused, and its reference count is incremented to track its usage. When the reference count reaches zero, indicating that no references to the object remain, the system will free the object from memory. This setting enhances performance by minimizing unnecessary object instantiation and promotes efficient memory management, particularly in scenarios where CRL objects are frequently used.

**UseInternalRandom**: Switches between SecureBlackbox-own and platform PRNGs.Allows to switch between internal/native PRNG implementation and the one provided by the platform.

**UseLegacyAdESValidation**: Enables legacy AdES validation mode.Use this setting to switch the AdES component to the validation approach that was used in SBB 2020/SBB 2022 (less attention to temporal details).

**UseOCSPResponseObjectCaching**: Specifies whether reuse of loaded OCSP response objects is enabled.This setting enables or disables the caching of OCSP response objects. When set to true (the default value), the system checks if a OCSP response object is already loaded in memory before attempting to load a new instance. If the object is found, the existing instance is reused, and its reference count is incremented to track its usage. When the reference count reaches zero, indicating that no references to the object remain, the system will free the object from memory. This setting enhances performance by minimizing unnecessary object instantiation and promotes efficient memory management, particularly in scenarios where OCSP response objects are frequently used.

**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.

**UseSystemNativeSizeCalculation**: An internal CryptoAPI access tweak.This is an internal setting. Please do not use it unless instructed by the support team.

**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.

**XMLRDNDescriptorName[OID]**: Defines an OID mapping to descriptor names for the certificate's IssuerRDN or SubjectRDN.This property defines custom mappings between Object Identifiers (OIDs) and descriptor names. This mapping specifies how the certificate's issuer and subject information (ds:IssuerRDN and ds:SubjectRDN elements respectively) are represented in XML signatures.

The property accepts comma-separated values where the first descriptor name is used when the OID is mapped, and subsequent values act as aliases for parsing.

Syntax:

```text
Config("XMLRDNDescriptorName[OID]=PrimaryName,Alias1,Alias2");
```

Where:

OID: The Object Identifier from the certificate's IssuerRDN or SubjectRDN that you want to map.

PrimaryName: The main descriptor name used in the XML signature when the OID is encountered.

Alias1, Alias2, ...: Optional alternative names recognized during parsing.

Usage Examples:

Map OID 2.5.4.5 to SERIALNUMBER:

```text
Config("XMLRDNDescriptorName[2.5.4.5]=SERIALNUMBER");
```

Map OID 1.2.840.113549.1.9.1 to E, with aliases EMAIL and EMAILADDRESS:

```text
Config("XMLRDNDescriptorName[1.2.840.113549.1.9.1]=E,EMAIL,EMAILADDRESS");
```

**XMLRDNDescriptorPriority[OID]**: Specifies the priority of descriptor names associated with a specific OID.This property specifies the priority of descriptor names associated with a specific OID that allows to reorder descriptors in the ds:IssuerRDN and ds:SubjectRDN elements during signing.

**XMLRDNDescriptorReverseOrder**: Specifies whether to reverse the order of descriptors in RDN.Specifies whether to reverse the order of descriptors in the ds:IssuerRDN and ds:SubjectRDN elements during XML signing. By default, this property is set to true (as specified in RFC 2253, 2.1).

**XMLRDNDescriptorSeparator**: Specifies the separator used between descriptors in RDN.Specifies the separator used between descriptors in the ds:IssuerRDN and ds:SubjectRDN elements during XML signing. By default, this property is set to ", " value.

# Trappable Errors ([SFTPServer](#sftpserver-class) Class)

### SFTPServer Errors

|  |  |
| --- | --- |
| 1048577 | Invalid parameter ([SB_ERROR_INVALID_PARAMETER](constants.md#const_SBERRORINVALIDPARAMETER)) |
| 1048578 | Invalid configuration ([SB_ERROR_INVALID_SETUP](constants.md#const_SBERRORINVALIDSETUP)) |
| 1048579 | Invalid state ([SB_ERROR_INVALID_STATE](constants.md#const_SBERRORINVALIDSTATE)) |
| 1048580 | Invalid value ([SB_ERROR_INVALID_VALUE](constants.md#const_SBERRORINVALIDVALUE)) |
| 1048581 | Private key not found ([SB_ERROR_NO_PRIVATE_KEY](constants.md#const_SBERRORNOPRIVATEKEY)) |
| 1048582 | Cancelled by the user ([SB_ERROR_CANCELLED_BY_USER](constants.md#const_SBERRORCANCELLEDBYUSER)) |
| 1048583 | The file was not found ([SB_ERROR_NO_SUCH_FILE](constants.md#const_SBERRORNOSUCHFILE)) |
| 1048584 | Unsupported feature or operation ([SB_ERROR_UNSUPPORTED_FEATURE](constants.md#const_SBERRORUNSUPPORTEDFEATURE)) |
| 1048585 | General error ([SB_ERROR_GENERAL_ERROR](constants.md#const_SBERRORGENERALERROR)) |
| 31457281 | Unsupported file operation ([SB_ERROR_SFTP_UNSUPPORTED_FILE_OPERATION](constants.md#const_SBERRORSFTPUNSUPPORTEDFILEOPERATION)) |
| 31457282 | Invalid authentication type ([SB_ERROR_SFTP_INVALID_AUTH_TYPE](constants.md#const_SBERRORSFTPINVALIDAUTHTYPE)) |
