private void populateSslElement(Ssl newSsl, WebListener webListener) {
if (webListener instanceof HttpsListener) {
HttpsListener listener = (HttpsListener) webListener;
SslConfig sslConfig = listener.getSslConfig();
if (sslConfig == null) {
return;
}
if (sslConfig.getKeyStore() != null) {
newSsl.setKeyStore(sslConfig.getKeyStore());
}
if (sslConfig.getKeyPassword() != null) {
newSsl.setKeyStorePassword(new String(sslConfig.getKeyPassword()));
}
if (sslConfig.getTrustStore() != null) {
newSsl.setTrustStore(sslConfig.getTrustStore());
}
if (sslConfig.getTrustPassword() != null) {
newSsl.setTrustStorePassword(new String(sslConfig.getTrustPassword()));
}
if (sslConfig.getAlgorithms() != null) {
for (SslType sslType : sslConfig.getAlgorithms()) {
if (sslType.equals(SslType.SSLv2)) {
newSsl.setSsl2Enabled("true");
}
if (sslType.equals(SslType.SSLv3)) {
newSsl.setSsl3Enabled("true");
}
if (sslType.equals(SslType.TLS)) {
newSsl.setSsl3TlsCiphers("true");
}
}
}
if (sslConfig.getHandshakeTimeout() > 0) {
newSsl.setSSLInactivityTimeout(sslConfig.getHandshakeTimeout());
}
if (sslConfig.getCertNickname() != null) {
newSsl.setCertNickname(sslConfig.getCertNickname());
}
} else {
log.severe("HttpsListener required for https protocol");
}