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

Prevent issues with non-existing keystore.

parent ffc7e0bb
......@@ -31,14 +31,6 @@
}
if (errors.isEmpty()) {
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;
try {
keystore = SSLConfig.getKeyStore();
......@@ -46,6 +38,14 @@
catch (Exception e) {
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
CertificateManager.installCert(keystore, SSLConfig.gets2sTrustStore(),
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