IP*Works! SSL V6

ipworksssl
Class Ftps

java.lang.Object
  |
  +--ipworksssl.Ftps

public class Ftps
extends java.lang.Object

The FTPS bean can be used to transfer files to and from FTP servers using the FTP Protocol.

The FTPS bean is the SSL-enabled equivalent of the IP*Works! FTP bean. The main difference is the introduction of a set of new configuration settings, properties and events that deal with SSL security. TheSSLProviderconfiguration setting chooses a security provider subsystem. TheSSLEnabledProtocolsandSSLCipherStrengthconfiguration settings determine which protocols are enabled and at what security level. The SSLCertStore , SSLCertSubject , and SSLCertEncoded properties are used to select a client certificate if the server is requesting client authentication. TheSSLSecurityFlagsconfiguration setting, together with the SSLServerAuthentication event allow you to check the server identity and other security attributes. Finally, the SSLStatus event provides information about the SSL handshake.

The FTPS bean implements a standard FTP client as specified in RFC 959 and RFC 1579 with the added option of SSL security (RFC 2228) in both the protocol and data channels.

The first step in using the bean is specifying the RemoteHost , User and Password . The file to upload to or download from is given by the RemoteFile property. The file to download to or upload from is specified by LocalFile . The current path in the server is specified by the RemotePath property. The Passive property is especially useful if the client is behind a firewall which inhibits incoming connections to higher ports.

If LocalFile is set to something other than an empty string, then files are received in LocalFile , otherwise the data is received through the Transfer event. StartTransfer and EndTransfer are fired at the beginning and end of transmission.

The PITrail event traces the interaction between the client and the server (the FTP Protocol Interface connection).

Directory listings are received through the DirList event.


Field Summary
static int fwNone
           
static int fwSOCKS4
           
static int fwSOCKS5
           
static int fwTunnel
           
static int sslAutomatic
           
static int sslExplicit
           
static int sslImplicit
           
static int sslNone
           
static int sstMachine
           
static int sstPEMKey
           
static int sstPFXBlob
           
static int sstPFXFile
           
static int sstUser
           
static int tmASCII
           
static int tmBinary
           
static int tmDefault
           
 
Constructor Summary
Ftps()
           
 
Method Summary
 void abort()
          Abort Current Upload/Download.
 void addFtpsEventListener(FtpsEventListener l)
           
 void append()
          Append data from LocalFile to a remote file RemoteFile on an FTP server.
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a beanconfiguration setting.
 void deleteFile(java.lang.String fileName)
          Remove a file specified by FileName from an FTP server.
 void doEvents()
          Processes events from the internal message queue.
 void download()
          Download a RemoteFile from an FTP server.
 java.lang.String getAccount()
          The user Account to login with.
 int getFileSize()
          The size of the file pointed to by RemoteFile .
 java.lang.String getFileTime()
          The last modification time of the file pointed to by RemoteFile .
 java.lang.String getFirewallHost()
          Name or IP address of firewall (optional).
 java.lang.String getFirewallPassword()
          A password if authentication is to be used when connecting through the firewall.
 int getFirewallPort()
          Port of the firewall to connect to.
 int getFirewallType()
          Determines the type of firewall to connect through.
 java.lang.String getFirewallUser()
          A user name if authentication is to be used connecting through a firewall.
 java.lang.String getLastReply()
          The last reply from the server.
 java.lang.String getLocalFile()
          The path to a local file for download/upload.
 java.lang.String getLocalHost()
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 java.lang.String getPassword()
          The password to login with.
 java.lang.String getRemoteFile()
          The name of the remote file for uploading, downloading, etc.
 java.lang.String getRemoteHost()
          The domain name or IP address of the FTP server.
 java.lang.String getRemotePath()
          The current path in the FTP server.
 int getRemotePort()
          The port for the FTP service (default is 21).
 byte[] getSSLAcceptServerCert()
          Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate.
 byte[] getSSLCertEncoded()
          The SSL certificate (PEM/base64 encoded).
 byte[] getSSLCertStore()
          The name of the certificate store for the client certificate.
 java.lang.String getSSLCertStorePassword()
          The password for the certificate store (if any).
 int getSSLCertStoreType()
          The type of certificate store for the client certificate.
 java.lang.String getSSLCertSubject()
          The subject of the certificate used for client authentication.
 byte[] getSSLServerCert()
          The server certificate for the last established connection.
 java.lang.String getSSLServerCertStatus()
          The verification status of the server certificate for the last established connection.
 int getSSLStartMode()
          Determines how the bean starts the SSL negotiation.
 java.lang.String getStartByte()
          The byte index in RemoteFile and LocalFile from which to start the transmission.
 int getTimeout()
          A timeout for the bean.
 int getTransferMode()
          The transfer mode (ASCII or Binary).
 java.lang.String getUser()
          The user id to login as.
 void interrupt()
          Interrupt the current method.
 boolean isConnected()
          Shows whether the bean is connected.
 boolean isIdle()
          The current status of the component.
 boolean isOverwrite()
          Whether or not the bean should overwrite files during transfer.
 boolean isPassive()
          Controls whether to direct the server into passive mode.
 void listDirectory()
          List the current directory specified by RemotePath on an FTP server.
 void listDirectoryLong()
          List extended directory information for RemotePath .
 void logoff()
          Logoff from the FTP server by posting a QUIT command.
 void logon()
          Logon to the FTP RemoteHost using the current User and Password .
 void makeDirectory(java.lang.String newDir)
          Create a directory on an FTP server.
 void removeDirectory(java.lang.String dirName)
          Remove a directory specified by DirName from an FTP server.
 void removeFtpsEventListener(FtpsEventListener l)
           
 void renameFile(java.lang.String newName)
          Change the name of RemoteFile to NewName .
 void setAccount(java.lang.String account)
          The user Account to login with.
 void setCommand(java.lang.String command)
          Can be used to send additional commands directly to the server.
 void setConnected(boolean connected)
          Shows whether the bean is connected.
 void setFirewallHost(java.lang.String firewallHost)
          Name or IP address of firewall (optional).
 void setFirewallPassword(java.lang.String firewallPassword)
          A password if authentication is to be used when connecting through the firewall.
 void setFirewallPort(int firewallPort)
          Port of the firewall to connect to.
 void setFirewallType(int firewallType)
          Determines the type of firewall to connect through.
 void setFirewallUser(java.lang.String firewallUser)
          A user name if authentication is to be used connecting through a firewall.
 void setLocalFile(java.lang.String localFile)
          The path to a local file for download/upload.
 void setLocalHost(java.lang.String localHost)
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 void setOverwrite(boolean overwrite)
          Whether or not the bean should overwrite files during transfer.
 void setPassive(boolean passive)
          Controls whether to direct the server into passive mode.
 void setPassword(java.lang.String password)
          The password to login with.
 void setRemoteFile(java.lang.String remoteFile)
          The name of the remote file for uploading, downloading, etc.
 void setRemoteHost(java.lang.String remoteHost)
          The domain name or IP address of the FTP server.
 void setRemotePath(java.lang.String remotePath)
          The current path in the FTP server.
 void setRemotePort(int remotePort)
          The port for the FTP service (default is 21).
 void setSSLAcceptServerCert(byte[] SSLAcceptServerCert)
          Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate.
 void setSSLCertEncoded(byte[] SSLCertEncoded)
          The SSL certificate (PEM/base64 encoded).
 void setSSLCertStore(byte[] SSLCertStore)
          The name of the certificate store for the client certificate.
 void setSSLCertStorePassword(java.lang.String SSLCertStorePassword)
          The password for the certificate store (if any).
 void setSSLCertStoreType(int SSLCertStoreType)
          The type of certificate store for the client certificate.
 void setSSLCertSubject(java.lang.String SSLCertSubject)
          The subject of the certificate used for client authentication.
 void setSSLStartMode(int SSLStartMode)
          Determines how the bean starts the SSL negotiation.
 void setStartByte(java.lang.String startByte)
          The byte index in RemoteFile and LocalFile from which to start the transmission.
 void setTimeout(int timeout)
          A timeout for the bean.
 void setTransferMode(int transferMode)
          The transfer mode (ASCII or Binary).
 void setUser(java.lang.String user)
          The user id to login as.
 void storeUnique()
          Upload a file with a Unique Name to an FTP server.
 void upload()
          Upload a file specified by LocalFile to an FTP server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fwNone

public static final int fwNone
See Also:
Constant Field Values

fwTunnel

public static final int fwTunnel
See Also:
Constant Field Values

fwSOCKS4

public static final int fwSOCKS4
See Also:
Constant Field Values

fwSOCKS5

public static final int fwSOCKS5
See Also:
Constant Field Values

sstUser

public static final int sstUser
See Also:
Constant Field Values

sstMachine

public static final int sstMachine
See Also:
Constant Field Values

sstPFXFile

public static final int sstPFXFile
See Also:
Constant Field Values

sstPFXBlob

public static final int sstPFXBlob
See Also:
Constant Field Values

sstPEMKey

public static final int sstPEMKey
See Also:
Constant Field Values

sslAutomatic

public static final int sslAutomatic
See Also:
Constant Field Values

sslImplicit

public static final int sslImplicit
See Also:
Constant Field Values

sslExplicit

public static final int sslExplicit
See Also:
Constant Field Values

sslNone

public static final int sslNone
See Also:
Constant Field Values

tmDefault

public static final int tmDefault
See Also:
Constant Field Values

tmASCII

public static final int tmASCII
See Also:
Constant Field Values

tmBinary

public static final int tmBinary
See Also:
Constant Field Values
Constructor Detail

Ftps

public Ftps()
Method Detail

getAccount

public java.lang.String getAccount()
The user Account to login with.

Some servers may require an Account in order to Logon or in order to access specific privileges, like uploading or deleting files.


setAccount

public void setAccount(java.lang.String account)
                throws IPWorksSSLException
The user Account to login with.

Some servers may require an Account in order to Logon or in order to access specific privileges, like uploading or deleting files.

IPWorksSSLException

setCommand

public void setCommand(java.lang.String command)
                throws IPWorksSSLException
Can be used to send additional commands directly to the server.

Check the LastReply property and/or trap the PITrail events coming from the server to get the response.

IPWorksSSLException

isConnected

public boolean isConnected()
Shows whether the bean is connected.

Use this property to determine whether the bean is connected to the remote host or not.


setConnected

public void setConnected(boolean connected)
                  throws IPWorksSSLException
Shows whether the bean is connected.

Use this property to determine whether the bean is connected to the remote host or not.

IPWorksSSLException

getFileSize

public int getFileSize()
The size of the file pointed to by RemoteFile .

When this property is read, the FTP server is queried for the file size, and the response is provided as the property value.

If the bean is not connected, 0 is returned.


getFileTime

public java.lang.String getFileTime()
The last modification time of the file pointed to by RemoteFile .

When this property is read, the FTP server is queried for the file modification time, and the response is provided as the property value.

If the bean is not connected, an empty string is returned.


getFirewallHost

public java.lang.String getFirewallHost()
Name or IP address of firewall (optional).

If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.

If the FirewallHost property is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, the FirewallHost property is set to the corresponding address. If the search is not successful, an error is returned.


setFirewallHost

public void setFirewallHost(java.lang.String firewallHost)
                     throws IPWorksSSLException
Name or IP address of firewall (optional).

If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.

If the FirewallHost property is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, the FirewallHost property is set to the corresponding address. If the search is not successful, an error is returned.

IPWorksSSLException

getFirewallPassword

public java.lang.String getFirewallPassword()
A password if authentication is to be used when connecting through the firewall.

if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


setFirewallPassword

public void setFirewallPassword(java.lang.String firewallPassword)
                         throws IPWorksSSLException
A password if authentication is to be used when connecting through the firewall.

if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.

IPWorksSSLException

getFirewallPort

public int getFirewallPort()
Port of the firewall to connect to.

The TCP port for the FirewallHost . See the description of the FirewallHost property for details.

Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.


setFirewallPort

public void setFirewallPort(int firewallPort)
                     throws IPWorksSSLException
Port of the firewall to connect to.

The TCP port for the FirewallHost . See the description of the FirewallHost property for details.

Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.

IPWorksSSLException

getFirewallType

public int getFirewallType()
Determines the type of firewall to connect through.

The applicable values are the following:

fwNone (0)
No firewall (default setting).
fwTunnel (1)
Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.


setFirewallType

public void setFirewallType(int firewallType)
                     throws IPWorksSSLException
Determines the type of firewall to connect through.

The applicable values are the following:

fwNone (0)
No firewall (default setting).
fwTunnel (1)
Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.

IPWorksSSLException

getFirewallUser

public java.lang.String getFirewallUser()
A user name if authentication is to be used connecting through a firewall.

if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


setFirewallUser

public void setFirewallUser(java.lang.String firewallUser)
                     throws IPWorksSSLException
A user name if authentication is to be used connecting through a firewall.

if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.

IPWorksSSLException

isIdle

public boolean isIdle()
The current status of the component.

Idle will be False if the component is currently busy (communicating and/or waiting for an answer), and True at all other times.


getLastReply

public java.lang.String getLastReply()
The last reply from the server.

This is the last reply received from the server. It can be used for information purposes. The same information and more can also be retrieved through the PITrail event.


getLocalFile

public java.lang.String getLocalFile()
The path to a local file for download/upload. If the file exists and Overwrite is true, it is overwritten.

The LocalFile property is used by the Upload and Download methods. See the method descriptions for more information.

Example (Setting LocalFile)

 FTPControl.Localfile = "C:\\localfile.txt"
 FTPControl.RemoteFile = "remotefile.txt"
 FTPControl.Download()
 
 FTPControl.Localfile = "C:\\localfile2.txt"
 FTPControl.RemoteFile = "folder/remotefile2.txt"
 FTPControl.Download() 


setLocalFile

public void setLocalFile(java.lang.String localFile)
                  throws IPWorksSSLException
The path to a local file for download/upload. If the file exists and Overwrite is true, it is overwritten.

The LocalFile property is used by the Upload and Download methods. See the method descriptions for more information.

Example (Setting LocalFile)

 FTPControl.Localfile = "C:\\localfile.txt"
 FTPControl.RemoteFile = "remotefile.txt"
 FTPControl.Download()
 
 FTPControl.Localfile = "C:\\localfile2.txt"
 FTPControl.RemoteFile = "folder/remotefile2.txt"
 FTPControl.Download() 

IPWorksSSLException

getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksSSLException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.

IPWorksSSLException

isOverwrite

public boolean isOverwrite()
Whether or not the bean should overwrite files during transfer.

This property is a value indicating whether or not the bean should overwrite downloaded files. If Overwrite is false, an error will be thrown whenever LocalFile exists before a download operation.


setOverwrite

public void setOverwrite(boolean overwrite)
                  throws IPWorksSSLException
Whether or not the bean should overwrite files during transfer.

This property is a value indicating whether or not the bean should overwrite downloaded files. If Overwrite is false, an error will be thrown whenever LocalFile exists before a download operation.

IPWorksSSLException

isPassive

public boolean isPassive()
Controls whether to direct the server into passive mode. Recommended if behind a firewall.

Many firewalls will not allow the FTP server to open a connection from outside to the higher ports where the FTP client bean expects them. If Passive is set to TRUE , the bean will use the PASV instead of the PORT command and will thus direct the server into passive mode: connections are initiated only by the client.


setPassive

public void setPassive(boolean passive)
                throws IPWorksSSLException
Controls whether to direct the server into passive mode. Recommended if behind a firewall.

Many firewalls will not allow the FTP server to open a connection from outside to the higher ports where the FTP client bean expects them. If Passive is set to TRUE , the bean will use the PASV instead of the PORT command and will thus direct the server into passive mode: connections are initiated only by the client.

IPWorksSSLException

getPassword

public java.lang.String getPassword()
The password to login with.

This property must be set before the bean connects to the FTP server.


setPassword

public void setPassword(java.lang.String password)
                 throws IPWorksSSLException
The password to login with.

This property must be set before the bean connects to the FTP server.

IPWorksSSLException

getRemoteFile

public java.lang.String getRemoteFile()
The name of the remote file for uploading, downloading, etc.

The RemoteFile is either an absolute file path, or a relative path based on RemotePath .

A number of methods use RemoteFile as an argument.

Example (Setting RemoteFile)

 FTPControl.Localfile = "C:\\localfile.txt"
 FTPControl.RemoteFile = "remotefile.txt"
 FTPControl.Download()
 
 FTPControl.Localfile = "C:\\localfile2.txt"
 FTPControl.RemoteFile = "folder/remotefile2.txt"
 FTPControl.Download() 


setRemoteFile

public void setRemoteFile(java.lang.String remoteFile)
                   throws IPWorksSSLException
The name of the remote file for uploading, downloading, etc.

The RemoteFile is either an absolute file path, or a relative path based on RemotePath .

A number of methods use RemoteFile as an argument.

Example (Setting RemoteFile)

 FTPControl.Localfile = "C:\\localfile.txt"
 FTPControl.RemoteFile = "remotefile.txt"
 FTPControl.Download()
 
 FTPControl.Localfile = "C:\\localfile2.txt"
 FTPControl.RemoteFile = "folder/remotefile2.txt"
 FTPControl.Download() 

IPWorksSSLException

getRemoteHost

public java.lang.String getRemoteHost()
The domain name or IP address of the FTP server.

The RemoteHost property specifies the IP address (IP number in dotted internet format) or Domain Name of the FTP server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the RemoteHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the RemoteHost property is set to the corresponding address. If the search is not successful, an error is returned.

If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.


setRemoteHost

public void setRemoteHost(java.lang.String remoteHost)
                   throws IPWorksSSLException
The domain name or IP address of the FTP server.

The RemoteHost property specifies the IP address (IP number in dotted internet format) or Domain Name of the FTP server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the RemoteHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the RemoteHost property is set to the corresponding address. If the search is not successful, an error is returned.

If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.

IPWorksSSLException

getRemotePath

public java.lang.String getRemotePath()
The current path in the FTP server.

The RemotePath shows the current working directory on the FTP server. It can also be used to change the working directory by setting it to an absolute directory path, or a relative path with respect to the existing value of RemotePath .

If the first two bytes of the new path are "..", then a change to one level above in the directory tree is performed.

Setting RemotePath causes the bean to send the appropriate command to the remote server only if connected.

Example (Changing Directory)

 FTPControl.Logon()
 FTPControl.RemotePath = "/home/user" 


setRemotePath

public void setRemotePath(java.lang.String remotePath)
                   throws IPWorksSSLException
The current path in the FTP server.

The RemotePath shows the current working directory on the FTP server. It can also be used to change the working directory by setting it to an absolute directory path, or a relative path with respect to the existing value of RemotePath .

If the first two bytes of the new path are "..", then a change to one level above in the directory tree is performed.

Setting RemotePath causes the bean to send the appropriate command to the remote server only if connected.

Example (Changing Directory)

 FTPControl.Logon()
 FTPControl.RemotePath = "/home/user" 

IPWorksSSLException

getRemotePort

public int getRemotePort()
The port for the FTP service (default is 21).

A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.

For implicit SSL, use port 990 (please refer to the SSLStartMode property for more information).


setRemotePort

public void setRemotePort(int remotePort)
                   throws IPWorksSSLException
The port for the FTP service (default is 21).

A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.

For implicit SSL, use port 990 (please refer to the SSLStartMode property for more information).

IPWorksSSLException

getSSLAcceptServerCert

public byte[] getSSLAcceptServerCert()
Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate.

If it finds any issues with the certificate presented by the server, the bean will normally terminate the connection with an error.

You may override this behavior by supplying a value for SSLAcceptServerCert . If the certificate supplied in SSLAcceptServerCert is the same as the certificate presented by the server, then the server certificate is accepted unconditionally, and the connection will continue normally.

Please note that this functionality is provided only for cases where you otherwise know that you are communicating with the right server. If used improperly, these property will create a security breach. Use it at your own risk.


setSSLAcceptServerCert

public void setSSLAcceptServerCert(byte[] SSLAcceptServerCert)
                            throws IPWorksSSLException
Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate.

If it finds any issues with the certificate presented by the server, the bean will normally terminate the connection with an error.

You may override this behavior by supplying a value for SSLAcceptServerCert . If the certificate supplied in SSLAcceptServerCert is the same as the certificate presented by the server, then the server certificate is accepted unconditionally, and the connection will continue normally.

Please note that this functionality is provided only for cases where you otherwise know that you are communicating with the right server. If used improperly, these property will create a security breach. Use it at your own risk.

IPWorksSSLException

getSSLCertEncoded

public byte[] getSSLCertEncoded()
The SSL certificate (PEM/base64 encoded).

This property is used to assign a specific certificate for SSL client authentication (SSL server authentication in the case of the IPDaemonS bean). The SSLCertStore and SSLCertSubject properties may also be used to specify a certificate.

When SSLCertEncoded is set, a search is initiated in the current SSLCertStore for the private key of the certificate. If the key is found, SSLCertSubject is updated to reflect the full subject of the selected certificate, otherwise SSLCertSubject is set to empty string.


setSSLCertEncoded

public void setSSLCertEncoded(byte[] SSLCertEncoded)
                       throws IPWorksSSLException
The SSL certificate (PEM/base64 encoded).

This property is used to assign a specific certificate for SSL client authentication (SSL server authentication in the case of the IPDaemonS bean). The SSLCertStore and SSLCertSubject properties may also be used to specify a certificate.

When SSLCertEncoded is set, a search is initiated in the current SSLCertStore for the private key of the certificate. If the key is found, SSLCertSubject is updated to reflect the full subject of the selected certificate, otherwise SSLCertSubject is set to empty string.

IPWorksSSLException

getSSLCertStore

public byte[] getSSLCertStore()
The name of the certificate store for the client certificate.

The SSLCertStoreType property specifies the type of the certificate store specified by SSLCertStore . If the store is password protected, specify the password in SSLCertStorePassword .

SSLCertStore is used in conjunction with the SSLCertSubject property in order to specify client certificates. If SSLCertStore has a value, and SSLCertSubject or SSLCertEncoded is set, a search for a certificate is initiated. Please refer to the SSLCertSubject property for details.

Designations of certificate stores are platform-dependent.

The following are designations of the most common User and Machine certificate stores in Windows:

MY
A certificate store holding personal certificates with their associated private keys.
CA
Certifying authority certificates.
ROOT
Root certificates.
SPC
Software publisher certificates.

In Java, the certificate store normally is a file containing certificates and optional private keys.

When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).

If the provider is OpenSSL, the certificate store is a file containing a certificate and a private key. This property must be set to the name of the file.


setSSLCertStore

public void setSSLCertStore(byte[] SSLCertStore)
                     throws IPWorksSSLException
The name of the certificate store for the client certificate.

The SSLCertStoreType property specifies the type of the certificate store specified by SSLCertStore . If the store is password protected, specify the password in SSLCertStorePassword .

SSLCertStore is used in conjunction with the SSLCertSubject property in order to specify client certificates. If SSLCertStore has a value, and SSLCertSubject or SSLCertEncoded is set, a search for a certificate is initiated. Please refer to the SSLCertSubject property for details.

Designations of certificate stores are platform-dependent.

The following are designations of the most common User and Machine certificate stores in Windows:

MY
A certificate store holding personal certificates with their associated private keys.
CA
Certifying authority certificates.
ROOT
Root certificates.
SPC
Software publisher certificates.

In Java, the certificate store normally is a file containing certificates and optional private keys.

When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).

If the provider is OpenSSL, the certificate store is a file containing a certificate and a private key. This property must be set to the name of the file.

IPWorksSSLException

getSSLCertStorePassword

public java.lang.String getSSLCertStorePassword()
The password for the certificate store (if any).

If the certificate store is of a type that requires a password, the value of this property is used to open the certificate store.


setSSLCertStorePassword

public void setSSLCertStorePassword(java.lang.String SSLCertStorePassword)
                             throws IPWorksSSLException
The password for the certificate store (if any).

If the certificate store is of a type that requires a password, the value of this property is used to open the certificate store.

IPWorksSSLException

getSSLCertStoreType

public int getSSLCertStoreType()
The type of certificate store for the client certificate.

This property can take one of the following values:

0 (sstUser - default)
For Windows, this specifies that the certificate store is a certificate store owned by the current user. For Java, this specifies that the certificate store is the name of a JKS (Java Key Store) file. If the provider is OpenSSL, this specifies that the certificate store is a file that contains PEM encoded certificate and private key.
1 (sstMachine)
The certificate store is a machine store (not available in Java and when provider is OpenSSL).
2 (sstPFXFile)
The certificate store is the name of a PFX (PKCS12) file containing certificates. If the provider is OpenSSL, the file may contain only one certificate and private key.
3 (sstPFXBlob)
The certificate store is a string (binary or base64 encoded) representing a certificate store in PFX (PKCS12) format.This setting is currently not supported when the provider is OpenSSL.

4 (sstPEMKey)
The certificate store is a string or filename that contains a PEM encoded certificate and private key.This store type is currently not supported in Java.


setSSLCertStoreType

public void setSSLCertStoreType(int SSLCertStoreType)
                         throws IPWorksSSLException
The type of certificate store for the client certificate.

This property can take one of the following values:

0 (sstUser - default)
For Windows, this specifies that the certificate store is a certificate store owned by the current user. For Java, this specifies that the certificate store is the name of a JKS (Java Key Store) file. If the provider is OpenSSL, this specifies that the certificate store is a file that contains PEM encoded certificate and private key.
1 (sstMachine)
The certificate store is a machine store (not available in Java and when provider is OpenSSL).
2 (sstPFXFile)
The certificate store is the name of a PFX (PKCS12) file containing certificates. If the provider is OpenSSL, the file may contain only one certificate and private key.
3 (sstPFXBlob)
The certificate store is a string (binary or base64 encoded) representing a certificate store in PFX (PKCS12) format.This setting is currently not supported when the provider is OpenSSL.

4 (sstPEMKey)
The certificate store is a string or filename that contains a PEM encoded certificate and private key.This store type is currently not supported in Java.

IPWorksSSLException

getSSLCertSubject

public java.lang.String getSSLCertSubject()
The subject of the certificate used for client authentication.

When this property is set, a search is performed in the current certificate store certificate with matching subject.

If an exact match is not found, the store is searched for subjects containing the value of the property.

When setting the property to a partial subject, CN= should be omitted. For example, the following code would find the certificate with subject CN=Test Certificate, OU=People, C=US

Example (Searching with partial subject)

 Control.CertSubject = "Test" 

If a match is not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks a random certificate in the certificate store.

If a matching certificate is found, the SSLCertSubject property is set to the full subject of the matching certificate.


setSSLCertSubject

public void setSSLCertSubject(java.lang.String SSLCertSubject)
                       throws IPWorksSSLException
The subject of the certificate used for client authentication.

When this property is set, a search is performed in the current certificate store certificate with matching subject.

If an exact match is not found, the store is searched for subjects containing the value of the property.

When setting the property to a partial subject, CN= should be omitted. For example, the following code would find the certificate with subject CN=Test Certificate, OU=People, C=US

Example (Searching with partial subject)

 Control.CertSubject = "Test" 

If a match is not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks a random certificate in the certificate store.

If a matching certificate is found, the SSLCertSubject property is set to the full subject of the matching certificate.

IPWorksSSLException

getSSLServerCert

public byte[] getSSLServerCert()
The server certificate for the last established connection.

SSLServerCert contains the server certificate for the last established connection.

SSLServerCert is reset every time a new connection is attempted.


getSSLServerCertStatus

public java.lang.String getSSLServerCertStatus()
The verification status of the server certificate for the last established connection.

When the verification fails, SSLServerCertStatus contains a string that indicates the reason(s) why, otherwise, it contains the string "OK".

Please note that the value of SSLServerCertStatus must be considered as only a suggestion as to the validity of the certificate. Application software must use its own logic to determine whether to accept the certificate or not, by using the SSLServerCert to access other certificate properties, or other application-specific information.

SSLServerCertStatus is reset an empty string every time a new connection is attempted.


getSSLStartMode

public int getSSLStartMode()
Determines how the bean starts the SSL negotiation.

The SSLStartMode property may have one of the following values:

0 (sslAutomatic - default)
If the remote port is set to the standard plaintext port of the protocol (where applicable), the bean will behave the same as if SSLStartMode is set to sslExplicit . In all other cases, SSL negotiation will be implicit ( sslImplicit ).
1 (sslImplicit)
The SSL negotiation will start immediately after the connection is established.
2 (sslExplicit)
The bean will first connect in plaintext, and then explicitly start SSL negotiation through a protocol command such as STARTTLS.
3 (sslNone)
No SSL negotiation, no SSL security. All communication will be in plaintext mode.


setSSLStartMode

public void setSSLStartMode(int SSLStartMode)
                     throws IPWorksSSLException
Determines how the bean starts the SSL negotiation.

The SSLStartMode property may have one of the following values:

0 (sslAutomatic - default)
If the remote port is set to the standard plaintext port of the protocol (where applicable), the bean will behave the same as if SSLStartMode is set to sslExplicit . In all other cases, SSL negotiation will be implicit ( sslImplicit ).
1 (sslImplicit)
The SSL negotiation will start immediately after the connection is established.
2 (sslExplicit)
The bean will first connect in plaintext, and then explicitly start SSL negotiation through a protocol command such as STARTTLS.
3 (sslNone)
No SSL negotiation, no SSL security. All communication will be in plaintext mode.

IPWorksSSLException

getStartByte

public java.lang.String getStartByte()
The byte index in RemoteFile and LocalFile from which to start the transmission.

The StartByte contains a zero-based index in both RemoteFile and LocalFile that determines the point where the transmission of data starts from. This is useful for resuming interrupted downloads and uploads of files from FTP servers.

Once set, the StartByte index is used for all future downloads/uploads. The property must be reset to "0" for normal downloads/uploads.

The type of the property is a string instead of numeric to allow for certain implementations that expect an alphanumeric marker of the start index.

In the Transfer event, the TransferredBytes parameter will include the bytes skipped (i.e. it will show StartByte more bytes than actually transferred).

NOTE: some FTP servers may not support the FTP 'REST' command. If that is the case with the server you are accessing, you will not be able to use the StartByte property.


setStartByte

public void setStartByte(java.lang.String startByte)
                  throws IPWorksSSLException
The byte index in RemoteFile and LocalFile from which to start the transmission.

The StartByte contains a zero-based index in both RemoteFile and LocalFile that determines the point where the transmission of data starts from. This is useful for resuming interrupted downloads and uploads of files from FTP servers.

Once set, the StartByte index is used for all future downloads/uploads. The property must be reset to "0" for normal downloads/uploads.

The type of the property is a string instead of numeric to allow for certain implementations that expect an alphanumeric marker of the start index.

In the Transfer event, the TransferredBytes parameter will include the bytes skipped (i.e. it will show StartByte more bytes than actually transferred).

NOTE: some FTP servers may not support the FTP 'REST' command. If that is the case with the server you are accessing, you will not be able to use the StartByte property.

IPWorksSSLException

getTimeout

public int getTimeout()
A timeout for the bean.

If the Timeout property is set to 0, all operations will run uninterrupted until successful completion, or an error condition is encountered.

If Timeout is set to a positive value, the bean will wait for the operation to complete before returning control.

The bean will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the bean throws an IPWorksException raises an IPWorksException exception .

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when data is successfully sent or received.

Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.

This behavior is controlled by theAbsoluteTimeoutconfiguration setting.

The default value for the Timeout property is 60 (seconds).


setTimeout

public void setTimeout(int timeout)
                throws IPWorksSSLException
A timeout for the bean.

If the Timeout property is set to 0, all operations will run uninterrupted until successful completion, or an error condition is encountered.

If Timeout is set to a positive value, the bean will wait for the operation to complete before returning control.

The bean will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the bean throws an IPWorksException raises an IPWorksException exception .

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when data is successfully sent or received.

Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.

This behavior is controlled by theAbsoluteTimeoutconfiguration setting.

The default value for the Timeout property is 60 (seconds).

IPWorksSSLException

getTransferMode

public int getTransferMode()
The transfer mode (ASCII or Binary). If the value is 0 (default), the initial server mode will be used.

The valid options for the TransferMode property are as follows:

tmDefault (0)
The initial mode of the FTP server is taken. No change.
tmASCII (1)
Files are transferred in ASCII mode (TYPE A).
tmBinary (2)
Files are transferred in Binary mode (TYPE I).


setTransferMode

public void setTransferMode(int transferMode)
                     throws IPWorksSSLException
The transfer mode (ASCII or Binary). If the value is 0 (default), the initial server mode will be used.

The valid options for the TransferMode property are as follows:

tmDefault (0)
The initial mode of the FTP server is taken. No change.
tmASCII (1)
Files are transferred in ASCII mode (TYPE A).
tmBinary (2)
Files are transferred in Binary mode (TYPE I).

IPWorksSSLException

getUser

public java.lang.String getUser()
The user id to login as.

This property must be set before the bean connects to the FTP server.


setUser

public void setUser(java.lang.String user)
             throws IPWorksSSLException
The user id to login as.

This property must be set before the bean connects to the FTP server.

IPWorksSSLException

config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksSSLException
Sets or retrieves a beanconfiguration setting.

Config is a generic method available in every bean. It is used to set and retrieveconfiguration settingsfor the bean.

Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.

IPWorksSSLException

abort

public void abort()
           throws IPWorksSSLException
Abort Current Upload/Download.

Sends an ABOR command to the FTP server. It is used to interrupt file uploads/downloads.

IPWorksSSLException

append

public void append()
            throws IPWorksSSLException
Append data from LocalFile to a remote file RemoteFile on an FTP server.

This command causes the server-DTP to accept the data transferred via the data connection and to store the data in a file at the server site. If the file specified in the pathname exists at the server site, then the data shall be appended to that file; otherwise the file specified in the pathname shall be created at the server site. Similar to the Upload method but the local file specified by LocalFile is appended to RemoteFile on the server as opposed to replacing it as done by the Upload method. RemoteFile is either an absolute path on the server, or a path relative to RemotePath . The server will create a file with that name if it doesn't already exist (similar to Upload). If there is no FTP session in place, one is automatically created by first calling the Logon method.

IPWorksSSLException

deleteFile

public void deleteFile(java.lang.String fileName)
                throws IPWorksSSLException
Remove a file specified by FileName from an FTP server.

The remote file or directory specified by FileName is deleted. FileName is either an absolute path on the server, or a path relative to RemotePath . If there is no FTP session in place, one is automatically created by first calling the Logon method.

IPWorksSSLException

doEvents

public void doEvents()
              throws IPWorksSSLException
Processes events from the internal message queue.

When DoEvents is called, the bean processes any available events. If no events are available, it waits for a preset period of time, and then returns.

IPWorksSSLException

download

public void download()
              throws IPWorksSSLException
Download a RemoteFile from an FTP server.

The remote file specified by RemoteFile is downloaded to the local file specified by LocalFile , or it is retrieved through the Transfer event, if the LocalFile property is "" (empty string). RemoteFile is either an absolute path on the server, or a path relative to RemotePath . If there is no FTP session in place, one is automatically created by first calling the Logon method.

Example (Download a File)

 FTPControl.Localfile = "C:\\localfile.txt"
 FTPControl.RemoteFile = "remotefile.txt"
 FTPControl.Download()
 
 FTPControl.Localfile = "C:\\localfile2.txt"
 FTPControl.RemoteFile = "folder/remotefile2.txt"
 FTPControl.Download() 

IPWorksSSLException

interrupt

public void interrupt()
               throws IPWorksSSLException
Interrupt the current method.

If there is no method in progress, Interrupt simply returns doing nothing.

IPWorksSSLException

listDirectory

public void listDirectory()
                   throws IPWorksSSLException
List the current directory specified by RemotePath on an FTP server.

A listing is requested for the directory (or file mask) specified in RemoteFile . RemoteFile is either an absolute path on the server, or a path relative to RemotePath . The file listing is received through the DirList event.

Similar to ListDirectory , except only file names are returned. If there is no FTP session in place, one is automatically created by first calling the Logon method.

IPWorksSSLException

listDirectoryLong

public void listDirectoryLong()
                       throws IPWorksSSLException
List extended directory information for RemotePath .

A listing is requested for the directory (or file mask) specified in RemoteFile . RemoteFile is either an absolute path on the server, or a path relative to RemotePath . The file listing is received through the DirList event. Extended file information is returned. If there is no FTP session in place, one is automatically created by first calling the Logon method.

IPWorksSSLException

logoff

public void logoff()
            throws IPWorksSSLException
Logoff from the FTP server by posting a QUIT command.

Logoff from the FTP server by posting a QUIT command. If that fails, the connection is terminated by the local host.

IPWorksSSLException

logon

public void logon()
           throws IPWorksSSLException
Logon to the FTP RemoteHost using the current User and Password .

Logon to the FTP server using the current User and Password . If TransferMode is not 0 (Default), then the FTP transfer mode is set to the appropriate value.

Example (Logging On)

 FTPControl.RemoteHost = "ftpserver"
 FTPControl.User = "username"
 FTPControl.Password = "password"
 FTPControl.Logon() 

IPWorksSSLException

makeDirectory

public void makeDirectory(java.lang.String newDir)
                   throws IPWorksSSLException
Create a directory on an FTP server.

A directory with path specified by NewDir is created on the FTP server. NewDir is either an absolute path on the server, or a path relative to RemotePath . If there is no FTP session in place, one is automatically created by first calling the Logon method.

IPWorksSSLException

removeDirectory

public void removeDirectory(java.lang.String dirName)
                     throws IPWorksSSLException
Remove a directory specified by DirName from an FTP server.

A directory with path specified by DirName is deleted on the FTP server. DirName is either an absolute path on the server, or a path relative to RemotePath . If there is no FTP session in place, one is automatically created by first calling the Logon method.

IPWorksSSLException

renameFile

public void renameFile(java.lang.String newName)
                throws IPWorksSSLException
Change the name of RemoteFile to NewName .

The name of remote file specified by RemoteFile is changed to NewName . RemoteFile and NewName are either absolute paths on the server, or a path relative to RemotePath . If there is no FTP session in place, one is automatically created by first calling the Logon method.

IPWorksSSLException

storeUnique

public void storeUnique()
                 throws IPWorksSSLException
Upload a file with a Unique Name to an FTP server.

Similar to the Upload method but the server determines a unique name for the LocalFile to be saved on the current directory given by RemotePath . The server includes the new name of the file in its response. The user should check the PITrail event, or LastReply property to retrieve this generated filename.

IPWorksSSLException

upload

public void upload()
            throws IPWorksSSLException
Upload a file specified by LocalFile to an FTP server.

The local file specified by LocalFile is uploaded to the remote file specified by RemoteFile . RemoteFile is either an absolute path on the server, or a path relative to RemotePath . If there is no FTP session in place, one is automatically created by first calling the Logon method.

If you want to append to a server file, please refer to the Append method.

Example (Upload a File)

 FTPControl.Localfile = "C:\\localfile.txt"
 FTPControl.RemoteFile = "remotefile.txt"
 FTPControl.Upload()
 
 FTPControl.Localfile = "C:\\localfile2.txt"
 FTPControl.RemoteFile = "folder/remotefile2.txt"
 FTPControl.Upload() 

IPWorksSSLException

addFtpsEventListener

public void addFtpsEventListener(FtpsEventListener l)
                          throws java.util.TooManyListenersException
java.util.TooManyListenersException

removeFtpsEventListener

public void removeFtpsEventListener(FtpsEventListener l)

IP*Works! SSL V6

Copyright (c) 2004 /n software inc. - All rights reserved.