if (keyStorePassword == null) {
throw new IllegalArgumentException(
"keyStorePassword or system property javax.net.ssl.keyStorePassword must be set");
}
}
SslSocketConnector sslConnector = new SslSocketConnector();
sslConnector.setSslKeyManagerFactoryAlgorithm(ssl.getKeyManagerFactoryAlgorithm());
sslConnector.setSslTrustManagerFactoryAlgorithm(ssl.getTrustManagerFactoryAlgorithm());
sslConnector.setProtocol(ssl.getProtocol());
sslConnector.setConfidentialPort(url.getPort());
sslConnector.setPassword(ssl.getKeyStorePassword());
sslConnector.setKeyPassword(ssl.getKeyPassword() != null ? ssl.getKeyPassword() : keyStorePassword);
sslConnector.setKeystore(keyStore);
sslConnector.setKeystoreType(ssl.getKeyStoreType());
sslConnector.setNeedClientAuth(ssl.isNeedClientAuth());
sslConnector.setWantClientAuth(ssl.isWantClientAuth());
// important to set this values for selfsigned keys
// otherwise the standard truststore of the jre is used
sslConnector.setTruststore(ssl.getTrustStore());
if (ssl.getTrustStorePassword() != null) {
// check is necessary because if a null password is set
// jetty would ask for a password on the comandline
sslConnector.setTrustPassword(ssl.getTrustStorePassword());
}
sslConnector.setTruststoreType(ssl.getTrustStoreType());
connector = sslConnector;
return connector;
}