How to Add Cipher Suites Support in Openfire and Smack

  • Post author:
  • Post category:Java

Creating the Openfire Patch

This is how to patch Openfire to add cipher suite support.

1. Download the Openfire source distribution from http://www.igniterealtime.org/downloads/source.jsp.

2. Edit the class org.jivesoftware.openfire.nio.NIOConnection.

3. Look for the following code, around line 355.

filter.setUseClientMode(clientMode);

4. Insert the following code after.

String cipherSuites = JiveGlobals.getProperty("xmpp.socket.ssl.cipherSuites");
if (cipherSuites != null && !cipherSuites.isEmpty()) {
      filter.setEnabledCipherSuites(cipherSuites.split(","));
}

5. Read the official instructions on how to build Openfire from source. You will need to build openfire.jar from the source distribution.

Creating the Smack Patch

1. Get the Smack code from http://www.igniterealtime.org/downloads/source.jsp.

2. Edit org.jivesoftware.smack.XMPPConnection.

3. Look for the following code, around line 817.

// Proceed to do the handshake
((SSLSocket) socket).startHandshake();

4. Insert the following lines before.

String cipherSuites = System.getProperty("https.cipherSuites");
if (cipherSuites != null && !cipherSuites.isEmpty()) {
   ((SSLSocket) socket).setEnabledCipherSuites(cipherSuites.split(","));
}

5. Read the official instructions on how to build Smack from source. You will need to build smack.jar from the source distribution.