diff options
author | dfarrelly <david.farrelly@est.tech> | 2020-02-27 08:24:15 +0000 |
---|---|---|
committer | dfarrelly <david.farrelly@est.tech> | 2020-02-27 14:26:53 +0000 |
commit | 732932155b1bde692fa98848529d0771ccf6faa4 (patch) | |
tree | 2f7e7b2a7d9a1d33bfe3db319dc1ee4b33d92c0f /src/main | |
parent | 1e93a1088b7fd71b6958623e4c5976835bc385fb (diff) |
Fix PM Mapper certficate handling1.3.1
Remove decoding of keystore files
Issue-ID: DCAEGEN2-2096
Signed-off-by: dfarrelly <david.farrelly@est.tech>
Change-Id: Ieccf3c6bb44a87fac2ec3d2f5883a7b0a914e712
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/onap/dcaegen2/services/pmmapper/ssl/SSLContextFactory.java | 10 |
1 files changed, 4 insertions, 6 deletions
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); |