An instance of this factory can be set as the value of the
mail.<protocol>.ssl.socketFactory property.
| Modifier and Type | Class and Description |
|---|---|
| private class | MailSSLSocketFactory.MailTrustManager
A default Trustmanager. |
| Modifier and Type | Field and Description |
|---|---|
| private SSLSocketFactory | adapteeFactory
Holds a SSLSocketFactory to pass all API-method-calls to |
| private KeyManager[] | keyManagers
Holds the KeyManager array to use |
| private SecureRandom | secureRandom
Holds the SecureRandom to use |
| private SSLContext | sslcontext
Holds a SSLContext to get SSLSocketFactories from |
| private boolean | trustAllHosts
Should all hosts be trusted? |
| private String[] | trustedHosts
String-array of trusted hosts |
| private TrustManager[] | trustManagers
Holds the TrustManager array to use |
| Access | Constructor and Description |
|---|---|
| public | |
| public | MailSSLSocketFactory(String
The protocol to use protocol)Initializes a new MailSSLSocketFactory with a given protocol. |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized Socket | createSocket(Socket
the existing socket socket, String the server host s, int the server port i, boolean close the underlying socket when this socket is closed flag)Implements abstract javax. |
| public synchronized Socket | |
| public synchronized Socket | createSocket(InetAddress
the server network address inetaddress, int the server port i, InetAddress the client network address inetaddress1, int the client port j)Implements abstract javax. |
| public synchronized Socket | createSocket(InetAddress
the server host inetaddress, int the server port i)Implements abstract javax. |
| public synchronized Socket | createSocket(String
the server host name with which to connect, or
s, int null for the loopback address.the server port i, InetAddress the local address the socket is bound to inetaddress, int the local port the socket is bound to j)Implements abstract javax. |
| public synchronized Socket | createSocket(String
the server host name with which to connect, or
s, int null for the loopback address.the server port i)Implements abstract javax. |
| public synchronized String[] | getDefaultCipherSuites()
Implements abstract javax. |
| public synchronized KeyManager[] | |
| public synchronized SecureRandom | |
| public synchronized String[] | getSupportedCipherSuites()
Implements abstract javax. |
| public synchronized String[] | |
| public synchronized TrustManager[] | |
| public synchronized boolean | Returns: true if "trustAllHosts" is set to true OR the server is contained in the "trustedHosts" array;name of the server we connected to server, SSLSocket SSLSocket connected to the server sslSocket)After a successful conection to the server, this method is called to ensure that the server should be trusted. |
| public synchronized boolean | |
| private synchronized void | newAdapteeFactory()
Gets an SSLSocketFactory based on the given (or default) KeyManager array, TrustManager array and SecureRandom and sets it to the instance var adapteeFactory. |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public synchronized void |
| adapteeFactory | back to summary |
|---|---|
| private SSLSocketFactory adapteeFactory Holds a SSLSocketFactory to pass all API-method-calls to | |
| keyManagers | back to summary |
|---|---|
| private KeyManager[] keyManagers Holds the KeyManager array to use | |
| secureRandom | back to summary |
|---|---|
| private SecureRandom secureRandom Holds the SecureRandom to use | |
| sslcontext | back to summary |
|---|---|
| private SSLContext sslcontext Holds a SSLContext to get SSLSocketFactories from | |
| trustAllHosts | back to summary |
|---|---|
| private boolean trustAllHosts Should all hosts be trusted? | |
| trustedHosts | back to summary |
|---|---|
| private String[] trustedHosts String-array of trusted hosts | |
| trustManagers | back to summary |
|---|---|
| private TrustManager[] trustManagers Holds the TrustManager array to use | |
| MailSSLSocketFactory | back to summary |
|---|---|
| public MailSSLSocketFactory() throws GeneralSecurityException Initializes a new MailSSLSocketFactory.
| |
| MailSSLSocketFactory | back to summary |
|---|---|
| public MailSSLSocketFactory(String protocol) throws GeneralSecurityException Initializes a new MailSSLSocketFactory with a given protocol. Normally the protocol will be specified as "TLS".
| |
| createSocket | back to summary |
|---|---|
| public synchronized Socket createSocket(Socket socket, String s, int i, boolean flag) throws IOException Implements abstract javax. Doc from javax. Returns a socket layered over an existing socket connected to the named host, at the given port. This constructor can be used when tunneling SSL through a proxy or when negotiating the use of SSL over an existing socket. The host and port refer to the logical peer destination. This socket is configured using the socket options established for this factory.
| |
| createSocket | back to summary |
|---|---|
| public synchronized Socket createSocket() throws IOException Overrides javax. Doc from javax. Creates an unconnected socket.
| |
| createSocket | back to summary |
|---|---|
| public synchronized Socket createSocket(InetAddress inetaddress, int i, InetAddress inetaddress1, int j) throws IOException Implements abstract javax. Doc from javax. Creates a socket and connect it to the specified remote address on the specified remote port. The socket will also be bound to the local address and port supplied. The socket is configured using the socket options established for this factory.
If there is a security manager, its
| |
| createSocket | back to summary |
|---|---|
| public synchronized Socket createSocket(InetAddress inetaddress, int i) throws IOException Implements abstract javax. Doc from javax. Creates a socket and connects it to the specified port number at the specified address. This socket is configured using the socket options established for this factory.
If there is a security manager, its
| |
| createSocket | back to summary |
|---|---|
| public synchronized Socket createSocket(String s, int i, InetAddress inetaddress, int j) throws IOException, UnknownHostException Implements abstract javax. Doc from javax. Creates a socket and connects it to the specified remote host on the specified remote port. The socket will also be bound to the local address and port supplied. This socket is configured using the socket options established for this factory.
If there is a security manager, its
| |
| createSocket | back to summary |
|---|---|
| public synchronized Socket createSocket(String s, int i) throws IOException, UnknownHostException Implements abstract javax. Doc from javax. Creates a socket and connects it to the specified remote host at the specified remote port. This socket is configured using the socket options established for this factory.
If there is a security manager, its
| |
| getDefaultCipherSuites | back to summary |
|---|---|
| public synchronized String[] getDefaultCipherSuites() Implements abstract javax. Doc from javax. Returns the list of cipher suites which are enabled by default. Unless a different list is enabled, handshaking on an SSL connection will use one of these cipher suites. The minimum quality of service for these defaults requires confidentiality protection and server authentication (that is, no anonymous cipher suites). The returned array includes cipher suites from the list of standard cipher suite names in the JSSE Cipher Suite Names section of the Java Security Standard Algorithm Names Specification, and may also include other cipher suites that the provider supports. | |
| getKeyManagers | back to summary |
|---|---|
public synchronized KeyManager[] getKeyManagers()
| |
| getSecureRandom | back to summary |
|---|---|
public synchronized SecureRandom getSecureRandom()
| |
| getSupportedCipherSuites | back to summary |
|---|---|
| public synchronized String[] getSupportedCipherSuites() Implements abstract javax. Doc from javax. Returns the names of the cipher suites which could be enabled for use on an SSL connection. Normally, only a subset of these will actually be enabled by default, since this list may include cipher suites which do not meet quality of service requirements for those defaults. Such cipher suites are useful in specialized applications. The returned array includes cipher suites from the list of standard cipher suite names in the JSSE Cipher Suite Names section of the Java Security Standard Algorithm Names Specification, and may also include other cipher suites that the provider supports. | |
| getTrustedHosts | back to summary |
|---|---|
public synchronized String[] getTrustedHosts()
| |
| getTrustManagers | back to summary |
|---|---|
public synchronized TrustManager[] getTrustManagers()
| |
| isServerTrusted | back to summary |
|---|---|
| public synchronized boolean isServerTrusted(String server, SSLSocket sslSocket) After a successful conection to the server, this method is called to ensure that the server should be trusted. | |
| isTrustAllHosts | back to summary |
|---|---|
public synchronized boolean isTrustAllHosts()
| |
| newAdapteeFactory | back to summary |
|---|---|
| private synchronized void newAdapteeFactory() throws KeyManagementException Gets an SSLSocketFactory based on the given (or default) KeyManager array, TrustManager array and SecureRandom and sets it to the instance var adapteeFactory.
| |
| setKeyManagers | back to summary |
|---|---|
public synchronized void setKeyManagers(KeyManager[] keyManagers) throws GeneralSecurityException
| |
| setSecureRandom | back to summary |
|---|---|
public synchronized void setSecureRandom(SecureRandom secureRandom) throws GeneralSecurityException
| |
| setTrustAllHosts | back to summary |
|---|---|
public synchronized void setTrustAllHosts(boolean trustAllHosts)
| |
| setTrustedHosts | back to summary |
|---|---|
public synchronized void setTrustedHosts(String[] trustedHosts)
| |
| setTrustManagers | back to summary |
|---|---|
public synchronized void setTrustManagers(TrustManager[] trustManagers) throws GeneralSecurityException
| |
| Modifier and Type | Field and Description |
|---|---|
| private X509TrustManager | adapteeTrustManager
A TrustManager to pass method calls to |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | checkClientTrusted(X509Certificate[]
the peer certificate chain certs, String the authentication type based on the client certificate authType)Implements javax. |
| public void | checkServerTrusted(X509Certificate[]
the peer certificate chain certs, String the key exchange algorithm used authType)Implements javax. |
| public X509Certificate[] | getAcceptedIssuers()
Implements javax. |
| adapteeTrustManager | back to summary |
|---|---|
| private X509TrustManager adapteeTrustManager A TrustManager to pass method calls to | |
| MailTrustManager | back to summary |
|---|---|
| private MailTrustManager() throws GeneralSecurityException Initializes a new TrustManager instance. | |
| checkClientTrusted | back to summary |
|---|---|
| public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException Implements javax. Doc from javax. Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for client SSL authentication based on the authentication type. The authentication type is determined by the actual certificate used. For instance, if RSAPublicKey is used, the authType should be "RSA". Checking is case-sensitive.
| |
| checkServerTrusted | back to summary |
|---|---|
| public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException Implements javax. Doc from javax. Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for server SSL authentication based on the authentication type. The authentication type is the key exchange algorithm portion of the cipher suites represented as a String, such as "RSA", "DHE_DSS". Note for some exportable cipher suites, the key exchange algorithm is determined at run time during the handshake. For instance, for TLS_RSA_EXPORT_WITH_RC4_40_MD5, the authType should be RSA_EXPORT when an ephemeral RSA key is used for the key exchange, and RSA when the key from the server certificate is used. Checking is case-sensitive.
| |
| getAcceptedIssuers | back to summary |
|---|---|
| public X509Certificate[] getAcceptedIssuers() Implements javax. Doc from javax. Return an array of certificate authority certificates which are trusted for authenticating peers.
| |