diff options
Diffstat (limited to 'src/main/java/com/juick/server/KeystoreManager.java')
-rw-r--r-- | src/main/java/com/juick/server/KeystoreManager.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/KeystoreManager.java b/src/main/java/com/juick/server/KeystoreManager.java index b1ce7a56..15b62e35 100644 --- a/src/main/java/com/juick/server/KeystoreManager.java +++ b/src/main/java/com/juick/server/KeystoreManager.java @@ -23,14 +23,12 @@ public class KeystoreManager { private KeyStore ks; - private KeyManagerFactory kmf; - public KeystoreManager(Resource keystore, String keystorePassword) { this.keystorePassword = keystorePassword; try (InputStream ksIs = keystore.getInputStream()) { ks = KeyStore.getInstance("PKCS12"); ks.load(ksIs, keystorePassword.toCharArray()); - kmf = KeyManagerFactory.getInstance(KeyManagerFactory + KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory .getDefaultAlgorithm()); kmf.init(ks, keystorePassword.toCharArray()); } catch (IOException | KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException | CertificateException e) { @@ -58,7 +56,7 @@ public class KeystoreManager { public String getPublicKeyPem() { String[] key = Base64Utils.encodeToString(getKeyPair().getPublic().getEncoded()).split("(?<=\\G.{64})"); return String.format("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n", - Arrays.asList(key).stream().collect(Collectors.joining("\n"))); + String.join("\n", key)); } public static PublicKey publicKeyOf(Person person) { String pubkeyPem = person.getPublicKey().getPublicKeyPem(); |