From f462d7335567960978e16c5e042c99b54daa94b6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 12 Dec 2019 11:28:12 +0300 Subject: Cleanup IDEA code issues --- src/main/java/com/juick/server/KeystoreManager.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/juick/server/KeystoreManager.java') 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(); -- cgit v1.2.3