diff --git a/src/main/java/de/mlessmann/certassist/keystore/KeyStoreManager.java b/src/main/java/de/mlessmann/certassist/keystore/KeyStoreManager.java index 3023753..95a4719 100644 --- a/src/main/java/de/mlessmann/certassist/keystore/KeyStoreManager.java +++ b/src/main/java/de/mlessmann/certassist/keystore/KeyStoreManager.java @@ -34,8 +34,6 @@ public class KeyStoreManager { throws JavaSecurityException { try { Path keystorePath = Files.createTempFile("keystore", ".jks"); - String keystorePassword = "changeit"; - String alias = "mykey"; // Load the keystore KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); @@ -47,12 +45,12 @@ public class KeyStoreManager { passwordProvider.getPasswordFor(serverCert.fingerprint()) ); Certificate[] certChain = loadCertificateChain(serverCert.fullchainPath()); - keystore.setKeyEntry(alias, privateKey, keystorePassword.toCharArray(), certChain); + keystore.setKeyEntry(serverCert.fingerprint(), privateKey, null, certChain); } // Save the keystore try (var keystoreOut = Files.newOutputStream(keystorePath, CREATE_TRUNCATE)) { - keystore.store(keystoreOut, keystorePassword.toCharArray()); + keystore.store(keystoreOut, keyStorePassphrase.toCharArray()); } return new KeystoreResult(keystorePath); } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) {