Allow storing db.user and db.pass in environment variables
[dmaap/datarouter.git] / datarouter-prov / src / main / java / org / onap / dmaap / datarouter / provisioning / utils / PasswordProcessor.java
index 4414203..a6a3e2b 100644 (file)
@@ -6,29 +6,31 @@
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- * <p>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p>\r
- * Unless required by applicable law or agreed to in writing, software\r
+ *\r
+ * <p>http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * <p>* Unless required by applicable law or agreed to in writing, software\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
- * <p>\r
- * SPDX-License-Identifier: Apache-2.0\r
+ *\r
+ * <p>* SPDX-License-Identifier: Apache-2.0\r
  * ============LICENSE_END=========================================================\r
  */\r
 \r
 package org.onap.dmaap.datarouter.provisioning.utils;\r
 \r
+import java.nio.charset.StandardCharsets;\r
+import java.security.GeneralSecurityException;\r
+import java.util.Base64;\r
+\r
 import javax.crypto.Cipher;\r
 import javax.crypto.SecretKey;\r
 import javax.crypto.SecretKeyFactory;\r
 import javax.crypto.spec.PBEKeySpec;\r
 import javax.crypto.spec.PBEParameterSpec;\r
-import java.nio.charset.StandardCharsets;\r
-import java.security.GeneralSecurityException;\r
-import java.util.Base64;\r
+import org.onap.dmaap.datarouter.provisioning.ProvRunner;\r
 \r
 /**\r
  * The Processing of a Password.  Password can be encrypted and decrypted.\r
@@ -37,12 +39,15 @@ import java.util.Base64;
  */\r
 public class PasswordProcessor {\r
 \r
-    private PasswordProcessor(){}\r
-\r
     private static final String SECRET_KEY_FACTORY_TYPE = "PBEWithMD5AndDES";\r
-    private static final String PASSWORD_ENCRYPTION_STRING = (new DB()).getProperties().getProperty("org.onap.dmaap.datarouter.provserver.passwordencryption");\r
+    private static final String PASSWORD_ENCRYPTION_STRING =\r
+            ProvRunner.getProvProperties().getProperty("org.onap.dmaap.datarouter.provserver.passwordencryption");\r
     private static final char[] PASSWORD = PASSWORD_ENCRYPTION_STRING.toCharArray();\r
-    private static final byte[] SALT = {(byte) 0xde, (byte) 0x33, (byte) 0x10, (byte) 0x12, (byte) 0xde, (byte) 0x33, (byte) 0x10, (byte) 0x12,};\r
+    private static final byte[] SALT = {(byte) 0xde, (byte) 0x33, (byte) 0x10,\r
+        (byte) 0x12, (byte) 0xde, (byte) 0x33, (byte) 0x10, (byte) 0x12,};\r
+\r
+    private PasswordProcessor(){\r
+    }\r
 \r
     /**\r
      * Encrypt password.\r