From c1b69dfb1297365d35f2ada8690f13f787d38b4f Mon Sep 17 00:00:00 2001 From: pa834y Date: Tue, 26 Mar 2019 14:29:38 -0400 Subject: Enhancement to use the common CryptoUtils Change-Id: I06718526382b424eab991f39a7dac1b5cf4f1b74 Issue-ID: POLICY-1422 Signed-off-by: pa834y --- .../src/main/java/org/onap/xacml/parser/ParseLog.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'LogParser/src/main') diff --git a/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java b/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java index 54e86d250..f12522af6 100644 --- a/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java +++ b/LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * LogParser * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,12 +45,11 @@ import java.util.Timer; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; - import org.apache.log4j.Logger; import org.onap.policy.common.im.IntegrityMonitor; import org.onap.policy.common.im.IntegrityMonitorException; import org.onap.policy.common.logging.flexlogger.FlexLogger; -import org.onap.policy.utils.CryptoUtils; +import org.onap.policy.utils.PeCryptoUtils; import org.onap.xacml.parser.LogEntryObject.LogType; /** @@ -62,6 +61,7 @@ public class ParseLog { // only logging last line of each log file processed to the log4j log file defined by property - PARSERLOGPATH private static final Logger log4jlogger = Logger.getLogger(ParseLog.class.getName()); + private static final String PROP_AES_KEY = "org.onap.policy.encryption.aes.key"; // processing logging private static org.onap.policy.common.logging.flexlogger.Logger logger = @@ -393,7 +393,7 @@ public class ParseLog { logger.debug("builder.toString(): " + builder.toString()); if (builder.toString().contains(last + dataFileName + lineRead)) { final String[] parseString = builder.toString().split(last + dataFileName + lineRead); - final String returnValue = parseString[1].replace("\r", ""); + final String returnValue = parseString[1].replace("\r", ""); return returnValue.trim(); } builder = new StringBuilder(); @@ -886,9 +886,10 @@ public class ParseLog { jdbcUrl = config.getProperty("JDBC_URL").replace("'", ""); jdbcUser = config.getProperty("JDBC_USER"); jdbcDriver = config.getProperty("JDBC_DRIVER"); - jdbcPassword = CryptoUtils.decryptTxtNoExStr(config.getProperty("JDBC_PASSWORD", "")); - config.setProperty("javax.persistence.jdbc.password", - CryptoUtils.decryptTxtNoExStr(config.getProperty("javax.persistence.jdbc.password", ""))); + + PeCryptoUtils.initAesKey(config.getProperty(PROP_AES_KEY)); + jdbcPassword = PeCryptoUtils.decrypt(config.getProperty("JDBC_PASSWORD")); + config.setProperty("javax.persistence.jdbc.password", jdbcPassword); return config; } catch (final IOException e) { -- cgit 1.2.3-korg