public class SocketFactoryCreator
extends java.lang.Object
X509CertChainValidator
.Constructor and Description |
---|
SocketFactoryCreator() |
Modifier and Type | Method and Description |
---|---|
static void |
connectWithHostnameChecking(javax.net.ssl.SSLSocket socket,
HostnameMismatchCallback callback)
This method, invoked on an initialized SSL socket will perform the initial handshake (if necessary)
and then check if the peer's hostname is matching its certificate.
|
static javax.net.ssl.SSLServerSocketFactory |
getServerSocketFactory(X509Credential c,
X509CertChainValidator v)
Same as
getServerSocketFactory(X509Credential, X509CertChainValidator, SecureRandom)
using SecureRandom implementation as the last argument. |
static javax.net.ssl.SSLServerSocketFactory |
getServerSocketFactory(X509Credential c,
X509CertChainValidator v,
java.security.SecureRandom r)
Returns an
SSLServerSocketFactory configured to check
client certificates with a provided validator. |
static javax.net.ssl.SSLSocketFactory |
getSocketFactory(X509Credential c,
X509CertChainValidator v)
Same as
getSocketFactory(X509Credential, X509CertChainValidator, SecureRandom)
using SecureRandom implementation as the last argument. |
static javax.net.ssl.SSLSocketFactory |
getSocketFactory(X509Credential c,
X509CertChainValidator v,
java.security.SecureRandom r)
Returns an
SSLSocketFactory configured to check
servers' certificates with a provided validator. |
static javax.net.ssl.SSLContext |
getSSLContext(X509Credential c,
X509CertChainValidator v,
java.security.SecureRandom r)
Low level interface.
|
static javax.net.ssl.X509TrustManager |
getSSLTrustManager(X509CertChainValidator v)
Creates a SSL trustmanager which uses the provided validator.
|
public static javax.net.ssl.X509TrustManager getSSLTrustManager(X509CertChainValidator v)
v
- validator to use for certificates validationpublic static javax.net.ssl.SSLContext getSSLContext(X509Credential c, X509CertChainValidator v, java.security.SecureRandom r)
SSLContext
object initialized with the
provided credential and validator.c
- credential to use for the created sockets. If null, then anonymous socket will be created,
what is useful only for client side.v
- validator to use for certificates validationr
- implementation providing random numbersSSLContext
objectpublic static javax.net.ssl.SSLServerSocketFactory getServerSocketFactory(X509Credential c, X509CertChainValidator v, java.security.SecureRandom r)
SSLServerSocketFactory
configured to check
client certificates with a provided validator. Server socket will use
the provided credentials.c
- credential to use for the server socketv
- validator to use for client's validationr
- implementation providing random numbersSSLServerSocketFactory
public static javax.net.ssl.SSLServerSocketFactory getServerSocketFactory(X509Credential c, X509CertChainValidator v)
getServerSocketFactory(X509Credential, X509CertChainValidator, SecureRandom)
using SecureRandom
implementation as the last argument. Note that this
method might block if the machine has not enough system entropy. It is not suggested to use
this method for setting up automatic test environments, however it is suitable for production setups.c
- credential to use for the server socketv
- validator to use for client's validationSSLServerSocketFactory
public static javax.net.ssl.SSLSocketFactory getSocketFactory(X509Credential c, X509CertChainValidator v, java.security.SecureRandom r)
SSLSocketFactory
configured to check
servers' certificates with a provided validator. Client socket will use
the provided credentials.c
- credential to use for the client socketv
- validator to use for server's validationr
- implementation providing random numbersSSLSocketFactory
public static javax.net.ssl.SSLSocketFactory getSocketFactory(X509Credential c, X509CertChainValidator v)
getSocketFactory(X509Credential, X509CertChainValidator, SecureRandom)
using SecureRandom
implementation as the last argument. Note that this
method might block if the machine has not enough system entropy. It is not suggested to use
this method for setting up automatic test environments, however it is suitable for production setups.c
- credential to use for the client socketv
- validator to use for server's validationSSLSocketFactory
public static void connectWithHostnameChecking(javax.net.ssl.SSLSocket socket, HostnameMismatchCallback callback) throws javax.net.ssl.SSLPeerUnverifiedException
socket
- socket to be checkedcallback
- used when there is mismatch.javax.net.ssl.SSLPeerUnverifiedException
- if the peer was not verified