SecureBlackbox Lite 2020 Node.js Edition

Questions / Feedback?

FTPClient Class

Properties   Methods   Events   Configuration Settings   Errors  

The FTPClient class provides client-side functionality for FTP and FTPS protocols.

Syntax

secureblackboxlite.ftpclient()

Remarks

FTPClient provides client-side support for the FTP (File Transfer Protocol) and FTPS (FTP-over-SSL) protocols. The FTPS protocol allows you to securely perform file transfer operations with a remote server over Transport Layer Security (TLS).

Note: TLS is a successor to the now deprecated SSL protocol, although the latter abbreviation is still widely used.

FTPClient is typically used in the following scenario:

  • Setting up the connection parameters
  • Connecting to the server and signing in
  • Performing file transfer operations
  • Closing the connection

Setting up the parameters

When working with FTP or FTP-over-TLS service you will often need to tune up several classes of settings:
  • Login credentials: these can be tuned up via the Username and Password properties.
  • TLS settings: these includes the TLS mode: explicit, implicit, or no TLS. You must get this setting right; otherwise you may not be able to connect. Use TLSSettings property to adjust this setting.
  • If your server requires you to authenticate with a certificate, you can provide one via the ClientChain property.
  • FTPClient validates the server certificate against the local security settings. If your server uses a custom or non-public PKI, you may need to provide the required trust anchors and CA certificates via the TrustedCertificates and KnownCertificates collections.
  • FTP protocol includes its own set of settings, such as PassiveMode, EncryptDataChannel, or AdjustPasvAddress. These may be configured on this stage, or later into the connection.
  • In some network environments, you may also need to make adjustments to SocketSettings and Proxy.

Connecting to the server and signing in

Call Connect to open the connection to the server. The component will use the provided credentials to sign you in automatically.

Performing file transfer operations

FTPClient offers the full set of FTP operations. These include file uploads (UploadFile or UploadBytes), file downloads (DownloadFile, DownloadBytes), and directory operations (ListDir, MakeDir).

Note that unlike SFTP, FTP only supports one transfer operation at a time. An ongoing operation should be completed or aborted before a new one can be started.

Closing the connection

Use Disconnect to close the FTP connection.

Useful info

During its work FTPClient communicates back via events. Progress event fires periodically during the transfer operation to let you know of the operation progress. ControlSend and ControlReceive report the protocol communication log. FileOperation and FileOperationResult report the start and completion of an individual transfer operation within a multi-file transfer call (such as UploadFiles).

Property List


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

AdjustPasvAddressEnables or disables automatic adjustment of passive-mode addresses.
BlockedCertCountThe number of records in the BlockedCert arrays.
BlockedCertBytesReturns raw certificate data in DER format.
BlockedCertHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
ClientCertCountThe number of records in the ClientCert arrays.
ClientCertBytesReturns raw certificate data in DER format.
ClientCertHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
ConnectedIndicates whether the class is connected to the server.
CtlConnInfoAEADCipherIndicates whether the encryption algorithm used is an AEAD cipher.
CtlConnInfoChainValidationDetailsThe details of a certificate chain validation outcome.
CtlConnInfoChainValidationResultThe outcome of a certificate chain validation routine.
CtlConnInfoCiphersuiteThe cipher suite employed by this connection.
CtlConnInfoClientAuthenticatedSpecifies whether client authentication was performed during this connection.
CtlConnInfoClientAuthRequestedSpecifies whether client authentication was requested during this connection.
CtlConnInfoConnectionEstablishedIndicates whether the connection has been established fully.
CtlConnInfoConnectionIDThe unique identifier assigned to this connection.
CtlConnInfoDigestAlgorithmThe digest algorithm used in a TLS-enabled connection.
CtlConnInfoEncryptionAlgorithmThe symmetric encryption algorithm used in a TLS-enabled connection.
CtlConnInfoExportableIndicates whether a TLS connection uses a reduced-strength exportable cipher.
CtlConnInfoKeyExchangeAlgorithmThe key exchange algorithm used in a TLS-enabled connection.
CtlConnInfoKeyExchangeKeyBitsThe length of the key exchange key of a TLS-enabled connection.
CtlConnInfoNamedECCurveThe elliptic curve used in this connection.
CtlConnInfoPFSCipherIndicates whether the chosen ciphersuite provides perfect forward secrecy (PFS).
CtlConnInfoPreSharedIdentityHintA hint professed by the server to help the client select the PSK identity to use.
CtlConnInfoPublicKeyBitsThe length of the public key.
CtlConnInfoResumedSessionIndicates whether a TLS-enabled connection was spawned from another TLS connection.
CtlConnInfoSecureConnectionIndicates whether TLS or SSL is enabled for this connection.
CtlConnInfoServerAuthenticatedIndicates whether server authentication was performed during a TLS-enabled connection.
CtlConnInfoSignatureAlgorithmThe signature algorithm used in a TLS handshake.
CtlConnInfoSymmetricBlockSizeThe block size of the symmetric algorithm used.
CtlConnInfoSymmetricKeyBitsThe key length of the symmetric algorithm used.
CtlConnInfoTotalBytesReceivedThe total number of bytes received over this connection.
CtlConnInfoTotalBytesSentThe total number of bytes sent over this connection.
CtlConnInfoValidationLogContains the server certificate's chain validation log.
CtlConnInfoVersionIndicates the version of SSL/TLS protocol negotiated during this connection.
CurrListEntryEntryFormatThe file listing format: cfefUnknown 0 cfefUnix 1 cfefWindows 2 cfefMLSD 3 .
CurrListEntryFileDateFile last modification date.
CurrListEntryFileTypeThe type of the entry: cfetUnknown 0 cfetDirectory 1 cfetFile 2 cfetSymlink 3 cfetSpecial 4 cfetCurrentDirectory 5 cfetParentDirectory 6 .
CurrListEntryHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
CurrListEntryNameThe file or directory name.
CurrListEntryPathThe full path to the file or directory.
CurrListEntryRawDataThe unparsed entry as returned by the server.
CurrListEntrySizeFile size in bytes.
DataConnInfoAEADCipherIndicates whether the encryption algorithm used is an AEAD cipher.
DataConnInfoChainValidationDetailsThe details of a certificate chain validation outcome.
DataConnInfoChainValidationResultThe outcome of a certificate chain validation routine.
DataConnInfoCiphersuiteThe cipher suite employed by this connection.
DataConnInfoClientAuthenticatedSpecifies whether client authentication was performed during this connection.
DataConnInfoClientAuthRequestedSpecifies whether client authentication was requested during this connection.
DataConnInfoConnectionEstablishedIndicates whether the connection has been established fully.
DataConnInfoConnectionIDThe unique identifier assigned to this connection.
DataConnInfoDigestAlgorithmThe digest algorithm used in a TLS-enabled connection.
DataConnInfoEncryptionAlgorithmThe symmetric encryption algorithm used in a TLS-enabled connection.
DataConnInfoExportableIndicates whether a TLS connection uses a reduced-strength exportable cipher.
DataConnInfoKeyExchangeAlgorithmThe key exchange algorithm used in a TLS-enabled connection.
DataConnInfoKeyExchangeKeyBitsThe length of the key exchange key of a TLS-enabled connection.
DataConnInfoNamedECCurveThe elliptic curve used in this connection.
DataConnInfoPFSCipherIndicates whether the chosen ciphersuite provides perfect forward secrecy (PFS).
DataConnInfoPreSharedIdentityHintA hint professed by the server to help the client select the PSK identity to use.
DataConnInfoPublicKeyBitsThe length of the public key.
DataConnInfoResumedSessionIndicates whether a TLS-enabled connection was spawned from another TLS connection.
DataConnInfoSecureConnectionIndicates whether TLS or SSL is enabled for this connection.
DataConnInfoServerAuthenticatedIndicates whether server authentication was performed during a TLS-enabled connection.
DataConnInfoSignatureAlgorithmThe signature algorithm used in a TLS handshake.
DataConnInfoSymmetricBlockSizeThe block size of the symmetric algorithm used.
DataConnInfoSymmetricKeyBitsThe key length of the symmetric algorithm used.
DataConnInfoTotalBytesReceivedThe total number of bytes received over this connection.
DataConnInfoTotalBytesSentThe total number of bytes sent over this connection.
DataConnInfoValidationLogContains the server certificate's chain validation log.
DataConnInfoVersionIndicates the version of SSL/TLS protocol negotiated during this connection.
EncryptDataChannelEnables or disables data channel encryption.
ExternalCryptoCustomParamsCustom parameters to be passed to the signing service (uninterpreted).
ExternalCryptoDataAdditional data to be included in the async state and mirrored back by the requestor.
ExternalCryptoExternalHashCalculationSpecifies whether the message hash is to be calculated at the external endpoint.
ExternalCryptoHashAlgorithmSpecifies the request's signature hash algorithm.
ExternalCryptoKeyIDThe ID of the pre-shared key used for DC request authentication.
ExternalCryptoKeySecretThe pre-shared key used for DC request authentication.
ExternalCryptoMethodSpecifies the asynchronous signing method.
ExternalCryptoModeSpecifies the external cryptography mode.
ExternalCryptoPublicKeyAlgorithmProvide public key algorithm here if the certificate is not available on the pre-signing stage.
KnownCertCountThe number of records in the KnownCert arrays.
KnownCertBytesReturns raw certificate data in DER format.
KnownCertHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
KnownCRLCountThe number of records in the KnownCRL arrays.
KnownCRLBytesReturns raw CRL data in DER format.
KnownCRLHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
KnownOCSPCountThe number of records in the KnownOCSP arrays.
KnownOCSPBytesBuffer containing raw OCSP response data.
KnownOCSPHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
PassiveModeEnables or disables passive transfer mode.
PasswordThe connecting user's authentication password.
ProxyAddressThe IP address of the proxy server.
ProxyAuthenticationThe authentication type used by the proxy server.
ProxyPasswordThe password to authenticate to the proxy server.
ProxyPortThe port on the proxy server to connect to.
ProxyProxyTypeThe type of the proxy server.
ProxyRequestHeadersContains HTTP request headers for WebTunnel and HTTP proxy.
ProxyResponseBodyContains the HTTP or HTTPS (WebTunnel) proxy response body.
ProxyResponseHeadersContains response headers received from an HTTP or HTTPS (WebTunnel) proxy server.
ProxyUseIPv6Specifies whether IPv6 should be used when connecting through the proxy.
ProxyUseProxyEnables or disables proxy-driven connection.
ProxyUsernameSpecifies the username credential for proxy authentication.
RestartAtThe offset to restart the file transfer from.
ServerCertCountThe number of records in the ServerCert arrays.
ServerCertBytesReturns raw certificate data in DER format.
ServerCertCAKeyIDA unique identifier (fingerprint) of the CA certificate's private key.
ServerCertFingerprintContains the fingerprint (a hash imprint) of this certificate.
ServerCertHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
ServerCertIssuerThe common name of the certificate issuer (CA), typically a company name.
ServerCertIssuerRDNA collection of information, in the form of [OID, Value] pairs, uniquely identifying the certificate issuer.
ServerCertKeyAlgorithmSpecifies the public key algorithm of this certificate.
ServerCertKeyBitsReturns the length of the public key.
ServerCertKeyFingerprintReturns a fingerprint of the public key contained in the certificate.
ServerCertKeyUsageIndicates the purposes of the key contained in the certificate, in the form of an OR'ed flag set.
ServerCertPublicKeyBytesContains the certificate's public key in DER format.
ServerCertSelfSignedIndicates whether the certificate is self-signed (root) or signed by an external CA.
ServerCertSerialNumberReturns the certificate's serial number.
ServerCertSigAlgorithmIndicates the algorithm that was used by the CA to sign this certificate.
ServerCertSubjectThe common name of the certificate holder, typically an individual's name, a URL, an e-mail address, or a company name.
ServerCertSubjectKeyIDContains a unique identifier (fingerprint) of the certificate's private key.
ServerCertSubjectRDNA collection of information, in the form of [OID, Value] pairs, uniquely identifying the certificate holder (subject).
ServerCertValidFromThe time point at which the certificate becomes valid, in UTC.
ServerCertValidToThe time point at which the certificate expires, in UTC.
SocketDNSModeSelects the DNS resolver to use: the class's (secure) built-in one, or the one provided by the system.
SocketDNSPortSpecifies the port number to be used for sending queries to the DNS server.
SocketDNSQueryTimeoutThe timeout (in milliseconds) for each DNS query.
SocketDNSServersThe addresses of DNS servers to use for address resolution, separated by commas or semicolons.
SocketDNSTotalTimeoutThe timeout (in milliseconds) for the whole resolution process.
SocketIncomingSpeedLimitThe maximum number of bytes to read from the socket, per second.
SocketLocalAddressThe local network interface to bind the socket to.
SocketLocalPortThe local port number to bind the socket to.
SocketOutgoingSpeedLimitThe maximum number of bytes to write to the socket, per second.
SocketTimeoutThe maximum period of waiting, in milliseconds, after which the socket operation is considered unsuccessful.
SocketUseIPv6Enables or disables IP protocol version 6.
TLSAutoValidateCertificatesSpecifies whether server-side TLS certificates should be validated automatically using internal validation rules.
TLSBaseConfigurationSelects the base configuration for the TLS settings.
TLSCiphersuitesA list of ciphersuites separated with commas or semicolons.
TLSECCurvesDefines the elliptic curves to enable.
TLSForceResumeIfDestinationChangesWhether to force TLS session resumption when the destination address changes.
TLSPreSharedIdentityDefines the identity used when the PSK (Pre-Shared Key) key-exchange mechanism is negotiated.
TLSPreSharedKeyContains the pre-shared for the PSK (Pre-Shared Key) key-exchange mechanism, encoded with base16.
TLSPreSharedKeyCiphersuiteDefines the ciphersuite used for PSK (Pre-Shared Key) negotiation.
TLSRenegotiationAttackPreventionModeSelects renegotiation attack prevention mechanism.
TLSRevocationCheckSpecifies the kind(s) of revocation check to perform.
TLSSSLOptionsVarious SSL (TLS) protocol options, set of cssloExpectShutdownMessage 0x001 Wait for the close-notify message when shutting down the connection cssloOpenSSLDTLSWorkaround 0x002 (DEPRECATED) Use a DTLS version workaround when talking to very old OpenSSL versions cssloDisableKexLengthAlignment 0x004 Do not align the client-side PMS by the RSA modulus size.
TLSTLSModeSpecifies the TLS mode to use.
TLSUseExtendedMasterSecretEnables Extended Master Secret Extension, as defined in RFC 7627.
TLSUseSessionResumptionEnables or disables TLS session resumption capability.
TLSVersionsTh SSL/TLS versions to enable by default.
TransferTypeSets the file transfer mode.
TrustedCertCountThe number of records in the TrustedCert arrays.
TrustedCertBytesReturns raw certificate data in DER format.
TrustedCertHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
UsernameThe connecting user's username (login name).

Method List


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

AbortAborts the previous FTP service command and any associated transfer of data.
AcctSends an Account command.
AppendBytesAppends a byte array to a server-side file.
AppendFileUploads a file to the server.
ChangeDirChanges the current directory.
ClearCommandChannelSends CCC (Clear Command Channel) command to the server.
ConfigSets or retrieves a configuration setting.
ConnectConnects to the FTP server.
DeleteDirDeletes a directory on the server.
DeleteFileDeletes a file on the server.
DirExistsChecks if a directory exists on the server.
DisconnectDisconnects from the server.
DownloadBytesDownloads a file from the server into an array of bytes.
DownloadFileDownloads a file from the server.
DownloadFilesDownloads multiple files from the server.
FileExistsChecks if a file exists on the server.
GetCurrentDirReturns the server-side current directory.
GetFileSizeReturns the size of a remote file.
ListDirLists the contents of a remote directory.
MakeDirCreates a new directory on the server.
NoopSends a NOOP command to the server.
RenameRenames a file.
SendCommandSends a custom command to the server.
UploadBytesUploads a byte array to the server.
UploadFileUploads a file to the server.
UploadFilesUploads multiple files to the 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.

CertificateValidateFires when the server's TLS certificate has to be validated.
ControlReceiveFires when data is received via the control channel.
ControlSendFires when data is about to be set via the control channel.
ErrorInformation about errors during data delivery.
ExternalSignHandles remote or external signing initiated by the SignExternal method or other source.
FileOperationMarks the start of a file transfer.
FileOperationResultReports the result of a file transfer operation.
ListEntryReports a single entry from the requested directory listing.
NotificationThis event notifies the application about an underlying control flow event.
ProgressReports the data transfer progress.
TextDataLineReports next transferred data line.

Configuration Settings


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

AccountInfoParameters for the ACCT command.
AuthCmdAuthorization command to be used to request an explicit SSL session.
CaseConversionWhether file names and paths should be case-converted.
CaseSensitiveCase-sensitivity of file names and paths.
CloseQuietlySet this to true to avoid sending QUIT command on session closure.
ConcurrentConnectionsNumber of simultaneous connections for download.
CopyModeWhat to do with the originals of the copied files.
ErrorOriginSpecifies where the error has been originated.
ErrorSeverityError severity.
EventOriginIndicates the channel that has fired the event.
ExtHOSTSupportedWhether HOST extension is supported.
ExtMDTMSupportedWhether MDTM extension is supported.
ExtMFMTSupportedWhether MFMT extension is supported.
ExtMLSTSupportedWhether MLST extension is supported.
ExtOPTSUTF8SupportedWhether OPTS UTF8 extension is supported.
ExtRESTSupportedWhether REST extension is supported.
ExtSIZESupportedWhether SIZE extension is supported.
ExtXCRCSupportedWhether XCRC extension is supported.
ExtXMD5SupportedWhether XMD5 extension is supported.
FTPBufferSizeBuffer size in binary mode.
FTPTextBufferSizeBuffer size in text mode.
IgnoreSystemTrustWhether trusted Windows Certificate Stores should be treated as trusted.
ListenTimeoutListening socket timeout.
LocalNewLineConventionDefines the local newline convention.
MinSizeForConcurrentDownloadFiles bigger than this size will be downloaded concurrently.
ModeWhat to do if the destination file already exists.
ModeZSwitches on data compression.
OptionsVarious FTP options.
RecursiveWhether to scan subdirectories.
TempPathPath for storing temporary files.
TolerateMinorChainIssuesWhether to tolerate minor chain issues.
TransferKeepAliveIntervalKeep-alive interval for the data channel transfers.
TransferTimeoutTimeout for data transfer in active mode.
UseMicrosoftCTLEnables or disables automatic use of Microsoft online certificate trust list.
UseProxySettingsForDataChannelWhether the proxy settings should be applied to data channel.
UseSystemCertificatesEnables or disables the use of the system certificates.

Copyright (c) 2022 /n software inc. - All rights reserved.
SecureBlackbox Lite 2020 Node.js Edition - Version 20.0 [Build 8166]