ByteBuffer.setUseDirectBuffers(isUseDirectBuffersInMina());
SslContextFactory factory = new SslContextFactory();
if (isServer) {
if (supportsTls) {
KeyStoreManagement keystoreMgmt = getKeystoreCertificateChains();
if (keystoreMgmt == null) {
throw new IllegalStateException("This configuration ostensibly supports TLS, yet doesn't provide valid keystore configuration");
}
factory.setKeyManagerFactoryKeyStore(keystoreMgmt.getKeyStore());
factory.setKeyManagerFactoryKeyStorePassword(keystorePassword);
if (wantClientAuth) {
KeyStoreManagement truststoreMgmt = getTruststoreCertificateChains();
if (truststoreMgmt == null) {
throw new IllegalStateException("This configuration ostensibly supports client auth, yet doesn't provide valid truststore configuration");
}
factory.setTrustManagerFactoryKeyStore(truststoreMgmt.getKeyStore());
}
}
}
else {
if (supportsTls) {
KeyStoreManagement truststoreMgmt = getTruststoreCertificateChains();
if (truststoreMgmt == null) {
throw new IllegalStateException("This configuration ostensibly supports TLS, yet doesn't provide valid truststore configuration");
}
factory.setTrustManagerFactoryKeyStore(truststoreMgmt.getKeyStore());
if (wantClientAuth) {
KeyStoreManagement keystoreMgmt = getKeystoreCertificateChains();
if (keystoreMgmt == null) {
throw new IllegalStateException("This configuration ostensibly supports client auth, yet doesn't provide valid keystore configuration");
}
factory.setKeyManagerFactoryKeyStore(keystoreMgmt.getKeyStore());
factory.setKeyManagerFactoryKeyStorePassword(keystorePassword);
}
}
}
SSLFilter sslFilter = null;