Commit 42903a5e authored by guus's avatar guus

OF-533: Protocol obtained from SSLContext should be configurable.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13001 b35dd754-fafc-0310-a699-88a17e54d16e
parent 41b6112f
......@@ -37,6 +37,7 @@ import javax.net.ssl.SSLEngineResult.HandshakeStatus;
import javax.net.ssl.SSLEngineResult.Status;
import org.jivesoftware.openfire.Connection;
import org.jivesoftware.util.JiveGlobals;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -68,8 +69,6 @@ public class TLSWrapper {
*/
private static boolean debug = false;
private static final String PROTOCOL = "TLS";
private SSLEngine tlsEngine;
private SSLEngineResult tlsEngineResult;
......@@ -83,6 +82,8 @@ public class TLSWrapper {
System.setProperty("javax.net.debug", "all");
}
String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm", "TLS");
// Create/initialize the SSLContext with key material
try {
// First initialize the key and trust material.
......@@ -108,7 +109,7 @@ public class TLSWrapper {
}
}
SSLContext tlsContext = SSLContext.getInstance(PROTOCOL);
SSLContext tlsContext = SSLContext.getInstance(algorithm);
tlsContext.init(km, tm, null);
......@@ -128,7 +129,7 @@ public class TLSWrapper {
} catch (KeyManagementException e) {
Log.error("TLSHandler startup problem.\n" + " SSLContext initialisation failed.", e);
} catch (NoSuchAlgorithmException e) {
Log.error("TLSHandler startup problem.\n" + " The " + PROTOCOL + " does not exist", e);
Log.error("TLSHandler startup problem.\n" + " The " + algorithm + " does not exist", e);
} catch (IOException e) {
Log.error("TLSHandler startup problem.\n"
+ " the KeyStore or TrustStore does not exist", e);
......
......@@ -346,7 +346,8 @@ public class NIOConnection implements Connection {
}
}
SSLContext tlsContext = SSLContext.getInstance("TLS");
String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm", "TLS");
SSLContext tlsContext = SSLContext.getInstance(algorithm);
tlsContext.init(km, tm, null);
......
......@@ -409,10 +409,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
// Start clients SSL unless it's been disabled.
if (isClientSSLListenerEnabled()) {
int port = getClientSSLListenerPort();
String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm");
if ("".equals(algorithm) || algorithm == null) {
algorithm = "TLS";
}
String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm", "TLS");
try {
// Create SocketAcceptor with correct number of processors
sslSocketAcceptor = buildSocketAcceptor();
......
......@@ -54,7 +54,8 @@ public class SimpleSSLSocketFactory extends SSLSocketFactory {
public SimpleSSLSocketFactory() {
try {
SSLContext sslcontent = SSLContext.getInstance("TLS");
String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm", "TLS");
SSLContext sslcontent = SSLContext.getInstance(algorithm);
sslcontent.init(null, // KeyManager not required
new TrustManager[] { new DummyTrustManager() },
new java.security.SecureRandom());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment