summaryrefslogtreecommitdiffstats
path: root/LogParser
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2019-04-03 02:01:34 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-03 02:01:34 +0000
commitd5f95d08ffd3f2e16b67aadae7007c7a51dfae19 (patch)
treea9388d004af2bf679b66524edbc53571ce06d8e1 /LogParser
parent338796c4d56d2e95aa2903d80589b3b35b5a3dd2 (diff)
parentc1b69dfb1297365d35f2ada8690f13f787d38b4f (diff)
Merge "Enhancement to use the common CryptoUtils"
Diffstat (limited to 'LogParser')
-rw-r--r--LogParser/parserlog.properties5
-rw-r--r--LogParser/src/main/java/org/onap/xacml/parser/ParseLog.java15
2 files changed, 12 insertions, 8 deletions
diff --git a/LogParser/parserlog.properties b/LogParser/parserlog.properties
index accf33866..a41fc4cbc 100644
--- a/LogParser/parserlog.properties
+++ b/LogParser/parserlog.properties
@@ -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.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -38,3 +38,6 @@ LOGPATH=C:\\Workspaces\\HealthCheck\\pap-rest.log
PARSERLOGPATH=parserlog.log
node_type=logparser
site_name=site_1
+
+# AES key for password encryption in config files
+#org.onap.policy.encryption.aes.key=12345678901234567890123456789012
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) {