Commit ad0270fa authored by Günther Niess's avatar Günther Niess Committed by niess

OF-30: Fix generating of the self-signed certificates after deletion

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11492 b35dd754-fafc-0310-a699-88a17e54d16e
parent 9e175540
......@@ -74,7 +74,6 @@ public class SSLConfig {
}
static {
String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm", "TLS");
storeType = JiveGlobals.getProperty("xmpp.socket.ssl.storeType", "jks");
// Get the keystore location. The default location is security/keystore
......@@ -315,6 +314,9 @@ public class SSLConfig {
try {
keyStore = KeyStore.getInstance(storeType);
keyStore.load(null, keypass.toCharArray());
s2sTrustStore = KeyStore.getInstance(storeType);
s2sTrustStore.load(null, s2sTrustpass.toCharArray());
}
catch (Exception e) {
Log.error("Unable to initialize keystore: ", e);
......@@ -327,9 +329,20 @@ public class SSLConfig {
*/
public static void saveStores() throws IOException {
try {
File keyStoreDirectory = new File(keyStoreLocation).getParentFile();
if (!keyStoreDirectory.exists())
keyStoreDirectory.mkdirs();
keyStore.store(new FileOutputStream(keyStoreLocation), keypass.toCharArray());
File s2sTrustStoreDirectory = new File(s2sTrustStoreLocation).getParentFile();
if (!s2sTrustStoreDirectory.exists())
s2sTrustStoreDirectory.mkdirs();
s2sTrustStore.store(new FileOutputStream(s2sTrustStoreLocation), s2sTrustpass.toCharArray());
if (c2sTrustStore != s2sTrustStore) {
File c2sTrustStoreDirectory = new File(c2sTrustStoreLocation).getParentFile();
if (!c2sTrustStoreDirectory.exists())
c2sTrustStoreDirectory.mkdirs();
c2sTrustStore.store(new FileOutputStream(c2sTrustStoreLocation), c2sTrustpass.toCharArray());
}
}
......
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