Commit 173e6204 authored by Guus der Kinderen's avatar Guus der Kinderen

Prevent issues with non-existing keystore.

parent ffc7e0bb
...@@ -31,14 +31,6 @@ ...@@ -31,14 +31,6 @@
} }
if (errors.isEmpty()) { if (errors.isEmpty()) {
try { try {
// Create an alias for the signed certificate
String domain = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
int index = 1;
String alias = domain + "_" + index;
while (SSLConfig.getKeyStore().containsAlias(alias)) {
index = index + 1;
alias = domain + "_" + index;
}
KeyStore keystore; KeyStore keystore;
try { try {
keystore = SSLConfig.getKeyStore(); keystore = SSLConfig.getKeyStore();
...@@ -46,6 +38,14 @@ ...@@ -46,6 +38,14 @@
catch (Exception e) { catch (Exception e) {
keystore = SSLConfig.initializeKeyStore(); keystore = SSLConfig.initializeKeyStore();
} }
// Create an alias for the signed certificate
String domain = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
int index = 1;
String alias = domain + "_" + index;
while (keystore.containsAlias(alias)) {
index = index + 1;
alias = domain + "_" + index;
}
// Import certificate // Import certificate
CertificateManager.installCert(keystore, SSLConfig.gets2sTrustStore(), CertificateManager.installCert(keystore, SSLConfig.gets2sTrustStore(),
SSLConfig.getKeyPassword(), alias, new ByteArrayInputStream(privateKey.getBytes()), passPhrase, SSLConfig.getKeyPassword(), alias, new ByteArrayInputStream(privateKey.getBytes()), passPhrase,
......
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