From d3ca9ae8d68df880ce3d81f3e0f49a5f78f17f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Le=C3=9Fmann=20=28=40MarkL4YG=29?= Date: Sat, 23 Nov 2024 20:05:25 +0100 Subject: [PATCH] fix: Remove placeholder fields from initial impl --- .../de/mlessmann/certassist/keystore/KeyStoreManager.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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) {