|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.net.SocketFactory javax.net.ssl.SSLSocketFactory com.sun.mail.util.MailSSLSocketFactory
public class MailSSLSocketFactory
An SSL socket factory that makes it easier to specify trust. This socket factory can be configured to trust all hosts or trust a specific set of hosts, in which case the server's certificate isn't verified. Alternatively, a custom TrustManager can be supplied.
An instance of this factory can be set as the value of the
mail.<protocol>.ssl.socketFactory
property.
Constructor Summary | |
---|---|
MailSSLSocketFactory()
Initializes a new MailSSLSocketFactory. |
|
MailSSLSocketFactory(String protocol)
Initializes a new MailSSLSocketFactory with a given protocol. |
Method Summary | |
---|---|
Socket |
createSocket()
|
Socket |
createSocket(InetAddress inetaddress,
int i)
|
Socket |
createSocket(InetAddress inetaddress,
int i,
InetAddress inetaddress1,
int j)
|
Socket |
createSocket(Socket socket,
String s,
int i,
boolean flag)
|
Socket |
createSocket(String s,
int i)
|
Socket |
createSocket(String s,
int i,
InetAddress inetaddress,
int j)
|
String[] |
getDefaultCipherSuites()
|
KeyManager[] |
getKeyManagers()
|
SecureRandom |
getSecureRandom()
|
String[] |
getSupportedCipherSuites()
|
String[] |
getTrustedHosts()
|
TrustManager[] |
getTrustManagers()
|
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. |
boolean |
isTrustAllHosts()
|
void |
setKeyManagers(KeyManager[] keyManagers)
|
void |
setSecureRandom(SecureRandom secureRandom)
|
void |
setTrustAllHosts(boolean trustAllHosts)
|
void |
setTrustedHosts(String[] trustedHosts)
|
void |
setTrustManagers(TrustManager[] trustManagers)
|
Methods inherited from class javax.net.ssl.SSLSocketFactory |
---|
getDefault |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MailSSLSocketFactory() throws GeneralSecurityException
GeneralSecurityException
public MailSSLSocketFactory(String protocol) throws GeneralSecurityException
protocol
- The protocol to use
NoSuchAlgorithmException
- if given protocol is not supported
GeneralSecurityException
Method Detail |
---|
public KeyManager[] getKeyManagers()
public void setKeyManagers(KeyManager[] keyManagers) throws GeneralSecurityException
keyManagers
- the keyManagers to set
GeneralSecurityException
public SecureRandom getSecureRandom()
public void setSecureRandom(SecureRandom secureRandom) throws GeneralSecurityException
secureRandom
- the secureRandom to set
GeneralSecurityException
public TrustManager[] getTrustManagers()
public void setTrustManagers(TrustManager[] trustManagers) throws GeneralSecurityException
trustManagers
- the trustManagers to set
GeneralSecurityException
public boolean isTrustAllHosts()
public void setTrustAllHosts(boolean trustAllHosts)
trustAllHosts
- should all hosts be trusted?public String[] getTrustedHosts()
public void setTrustedHosts(String[] trustedHosts)
trustedHosts
- the hosts to trustpublic boolean isServerTrusted(String server, SSLSocket sslSocket)
server
- name of the server we connected tosslSocket
- SSLSocket connected to the server
public Socket createSocket(Socket socket, String s, int i, boolean flag) throws IOException
createSocket
in class SSLSocketFactory
IOException
public String[] getDefaultCipherSuites()
getDefaultCipherSuites
in class SSLSocketFactory
public String[] getSupportedCipherSuites()
getSupportedCipherSuites
in class SSLSocketFactory
public Socket createSocket() throws IOException
createSocket
in class SocketFactory
IOException
public Socket createSocket(InetAddress inetaddress, int i, InetAddress inetaddress1, int j) throws IOException
createSocket
in class SocketFactory
IOException
public Socket createSocket(InetAddress inetaddress, int i) throws IOException
createSocket
in class SocketFactory
IOException
public Socket createSocket(String s, int i, InetAddress inetaddress, int j) throws IOException, UnknownHostException
createSocket
in class SocketFactory
IOException
UnknownHostException
public Socket createSocket(String s, int i) throws IOException, UnknownHostException
createSocket
in class SocketFactory
IOException
UnknownHostException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |