fix: Remove placeholder fields from initial impl

This commit is contained in:
Magnus Leßmann (@MarkL4YG) 2024-11-23 20:05:25 +01:00
parent 8ffac7e02c
commit d3ca9ae8d6
Signed by: Mark.TwoFive
GPG key ID: 5B5EBCBE331F1E6F

View file

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