From 732932155b1bde692fa98848529d0771ccf6faa4 Mon Sep 17 00:00:00 2001 From: dfarrelly Date: Thu, 27 Feb 2020 08:24:15 +0000 Subject: Fix PM Mapper certficate handling Remove decoding of keystore files Issue-ID: DCAEGEN2-2096 Signed-off-by: dfarrelly Change-Id: Ieccf3c6bb44a87fac2ec3d2f5883a7b0a914e712 --- .../onap/dcaegen2/services/pmmapper/ssl/SSLContextFactory.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/ssl/SSLContextFactory.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/ssl/SSLContextFactory.java index 0bfdaa6..2b81c0a 100644 --- a/src/main/java/org/onap/dcaegen2/services/pmmapper/ssl/SSLContextFactory.java +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/ssl/SSLContextFactory.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,15 +103,13 @@ public class SSLContextFactory { private KeyStore loadKeyStore(String path, String passwordPath) throws IOException, NoSuchAlgorithmException { String type = "JKS"; - String encodedKeystore = new String(readAllBytes(Paths.get(path))); String password = getPassword(passwordPath); - - KeyStore keyStore = null; + KeyStore keyStore; try { keyStore = KeyStore.getInstance(type); - byte[] decodedKeystore = Base64.getMimeDecoder().decode(encodedKeystore); - InputStream stream = new ByteArrayInputStream(decodedKeystore); + byte[] keystoreBytes = readAllBytes(Paths.get(path)); + InputStream stream = new ByteArrayInputStream(keystoreBytes); keyStore.load(stream, password.toCharArray()); } catch(KeyStoreException | CertificateException e) { logger.unwrap().error("Failed to load Keystore from given configuration.", e); -- cgit 1.2.3-korg