org.apache.commons.net.ftp

Class FTPSClient

public class FTPSClient extends FTPClient

FTP over SSL processing. If desired, the JVM property -Djavax.net.debug=all can be used to see wire-level SSL details.

Since: 2.0

Version: $Id: FTPSClient.java 658520 2008-05-21 01:14:11Z sebb $

Field Summary
static StringKEYSTORE_ALGORITHM
keystore algorithm name.
static StringPROVIDER
provider name.
static StringSTORE_TYPE
truststore type.
static StringTRUSTSTORE_ALGORITHM
truststore algorithm name.
Constructor Summary
FTPSClient()
Constructor for FTPSClient.
FTPSClient(boolean isImplicit)
Constructor for FTPSClient.
FTPSClient(String protocol)
Constructor for FTPSClient.
FTPSClient(String protocol, boolean isImplicit)
Constructor for FTPSClient.
Method Summary
voidexecPBSZ(long pbsz)
PBSZ command. pbsz value: 0 to (2^32)-1 decimal integer.
voidexecPROT(String prot)
PROT command.
C - Clear
S - Safe(SSL protocol only)
E - Confidential(SSL protocol only)
P - Private
StringgetAuthValue()
Return AUTH command use value.
String[]getEnabledCipherSuites()
Returns the names of the cipher suites which could be enabled for use on this connection.
String[]getEnabledProtocols()
Returns the names of the protocol versions which are currently enabled for use on this connection.
booleangetEnableSessionCreation()
Returns true if new SSL sessions may be established by this socket.
booleangetNeedClientAuth()
Returns true if the socket will require client authentication.
TrustManagergetTrustManager()
Get the currently configured TrustManager.
booleangetUseClientMode()
Returns true if the socket is set to use client mode in its first handshake.
booleangetWantClientAuth()
Returns true if the socket will request client authentication.
voidsetAuthValue(String auth)
Set AUTH command use value.
voidsetEnabledCipherSuites(String[] cipherSuites)
Controls which particular cipher suites are enabled for use on this connection.
voidsetEnabledProtocols(String[] protocolVersions)
Controls which particular protocol versions are enabled for use on this connection.
voidsetEnabledSessionCreation(boolean isCreation)
Controls whether new a SSL session may be established by this socket.
voidsetKeyManager(KeyManager keyManager)
Set a KeyManager to use
voidsetNeedClientAuth(boolean isNeedClientAuth)
Configures the socket to require client authentication.
voidsetTrustManager(TrustManager trustManager)
Override the default TrustManager to use.
voidsetUseClientMode(boolean isClientMode)
Configures the socket to use client (or server) mode in its first handshake.
voidsetWantClientAuth(boolean isWantClientAuth)
Configures the socket to request client authentication, but only if such a request is appropriate to the cipher suite negotiated.

Field Detail

KEYSTORE_ALGORITHM

public static String KEYSTORE_ALGORITHM
keystore algorithm name.

PROVIDER

public static String PROVIDER
provider name.

STORE_TYPE

public static String STORE_TYPE
truststore type.

TRUSTSTORE_ALGORITHM

public static String TRUSTSTORE_ALGORITHM
truststore algorithm name.

Constructor Detail

FTPSClient

public FTPSClient()
Constructor for FTPSClient.

Throws: NoSuchAlgorithmException A requested cryptographic algorithm is not available in the environment.

FTPSClient

public FTPSClient(boolean isImplicit)
Constructor for FTPSClient.

Parameters: isImplicit The secutiry mode(Implicit/Explicit).

Throws: NoSuchAlgorithmException A requested cryptographic algorithm is not available in the environment.

FTPSClient

public FTPSClient(String protocol)
Constructor for FTPSClient.

Parameters: protocol the protocol

Throws: NoSuchAlgorithmException A requested cryptographic algorithm is not available in the environment.

FTPSClient

public FTPSClient(String protocol, boolean isImplicit)
Constructor for FTPSClient.

Parameters: protocol the protocol isImplicit The secutiry mode(Implicit/Explicit).

Throws: NoSuchAlgorithmException A requested cryptographic algorithm is not available in the environment.

Method Detail

execPBSZ

public void execPBSZ(long pbsz)
PBSZ command. pbsz value: 0 to (2^32)-1 decimal integer.

Parameters: pbsz Protection Buffer Size.

Throws: SSLException If it server reply code not equal "200". IOException If an I/O error occurs while either sending the command.

execPROT

public void execPROT(String prot)
PROT command.
C - Clear
S - Safe(SSL protocol only)
E - Confidential(SSL protocol only)
P - Private

Parameters: prot Data Channel Protection Level.

Throws: SSLException If it server reply code not equal "200". IOException If an I/O error occurs while either sending the command.

getAuthValue

public String getAuthValue()
Return AUTH command use value.

Returns: AUTH command use value.

getEnabledCipherSuites

public String[] getEnabledCipherSuites()
Returns the names of the cipher suites which could be enabled for use on this connection. When a socket does not have a ssl socket, This return null.

Returns: An array of cipher suite names.

getEnabledProtocols

public String[] getEnabledProtocols()
Returns the names of the protocol versions which are currently enabled for use on this connection. When a socket does not have a ssl socket, This return null.

Returns: An array of protocols.

getEnableSessionCreation

public boolean getEnableSessionCreation()
Returns true if new SSL sessions may be established by this socket. When a socket does not have a ssl socket, This return False.

Returns: true - Indicates that sessions may be created; this is the default. false - indicates that an existing session must be resumed.

getNeedClientAuth

public boolean getNeedClientAuth()
Returns true if the socket will require client authentication. When a socket does not have a ssl socket, This return False.

Returns: true - If the server mode socket should request that the client authenticate itself.

getTrustManager

public TrustManager getTrustManager()
Get the currently configured TrustManager.

Returns: A TrustManager instance.

getUseClientMode

public boolean getUseClientMode()
Returns true if the socket is set to use client mode in its first handshake. When a socket does not have a ssl socket, This return False.

Returns: true - If the socket should start its first handshake in "client" mode.

getWantClientAuth

public boolean getWantClientAuth()
Returns true if the socket will request client authentication. When a socket does not have a ssl socket, This return False.

Returns: true - If the server mode socket should request that the client authenticate itself.

setAuthValue

public void setAuthValue(String auth)
Set AUTH command use value. This processing is done before connected processing.

Parameters: auth AUTH command use value.

setEnabledCipherSuites

public void setEnabledCipherSuites(String[] cipherSuites)
Controls which particular cipher suites are enabled for use on this connection. I perform setting before a server negotiation.

Parameters: cipherSuites The cipher suites.

setEnabledProtocols

public void setEnabledProtocols(String[] protocolVersions)
Controls which particular protocol versions are enabled for use on this connection. I perform setting before a server negotiation.

Parameters: protocolVersions The protocol versions.

setEnabledSessionCreation

public void setEnabledSessionCreation(boolean isCreation)
Controls whether new a SSL session may be established by this socket.

Parameters: isCreation The established socket flag.

setKeyManager

public void setKeyManager(KeyManager keyManager)
Set a KeyManager to use

Parameters: keyManager The KeyManager implementation to set.

setNeedClientAuth

public void setNeedClientAuth(boolean isNeedClientAuth)
Configures the socket to require client authentication.

Parameters: isNeedClientAuth The need client auth flag.

setTrustManager

public void setTrustManager(TrustManager trustManager)
Override the default TrustManager to use.

Parameters: trustManager The TrustManager implementation to set.

setUseClientMode

public void setUseClientMode(boolean isClientMode)
Configures the socket to use client (or server) mode in its first handshake.

Parameters: isClientMode The use client mode flag.

setWantClientAuth

public void setWantClientAuth(boolean isWantClientAuth)
Configures the socket to request client authentication, but only if such a request is appropriate to the cipher suite negotiated.

Parameters: isWantClientAuth The want client auth flag.