summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appc-config/appc-encryption-tool/.gitignore1
-rw-r--r--appc-config/appc-encryption-tool/features/.gitignore1
-rw-r--r--appc-config/appc-encryption-tool/features/pom.xml94
-rw-r--r--appc-config/appc-encryption-tool/features/src/main/resources/features.xml49
-rw-r--r--appc-config/appc-encryption-tool/installer/pom.xml148
-rw-r--r--appc-config/appc-encryption-tool/installer/src/assembly/assemble_installer_zip.xml59
-rw-r--r--appc-config/appc-encryption-tool/installer/src/assembly/assemble_mvnrepo_zip.xml47
-rw-r--r--appc-config/appc-encryption-tool/installer/src/main/resources/scripts/install-feature.sh40
-rw-r--r--appc-config/appc-encryption-tool/pom.xml47
-rw-r--r--appc-config/appc-encryption-tool/provider/.gitignore1
-rw-r--r--appc-config/appc-encryption-tool/provider/appc_southbound.properties4
-rw-r--r--appc-config/appc-encryption-tool/provider/pom.xml80
-rw-r--r--appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/EncryptionToolActivator.java55
-rw-r--r--appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/Constants.java33
-rw-r--r--appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/DbServiceUtil.java72
-rw-r--r--appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/EncryptionTool.java214
-rw-r--r--appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/EncryptionToolDGWrapper.java80
-rw-r--r--appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/WrapperEncryptionTool.java142
-rw-r--r--appc-config/appc-encryption-tool/provider/src/test/java/org/openecomp/appc/encryptiontool/TestEncryptionTool.java65
-rw-r--r--appc-config/appc-encryption-tool/provider/src/test/resources/svclogic.properties33
-rw-r--r--appc-config/pom.xml3
21 files changed, 1267 insertions, 1 deletions
diff --git a/appc-config/appc-encryption-tool/.gitignore b/appc-config/appc-encryption-tool/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-encryption-tool/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-encryption-tool/features/.gitignore b/appc-config/appc-encryption-tool/features/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-encryption-tool/features/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-encryption-tool/features/pom.xml b/appc-config/appc-encryption-tool/features/pom.xml
new file mode 100644
index 000000000..581517444
--- /dev/null
+++ b/appc-config/appc-encryption-tool/features/pom.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-encryption-tool</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-config-encryption-tool-features</artifactId>
+ <name>APPC Encryption Tool Plugin - Features</name>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-encryption-tool-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <version>${odl.mdsal.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <!-- dependency for opendaylight-karaf-empty for use by testing -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>opendaylight-karaf-empty</artifactId>
+ <version>${odl.karaf.empty.distro.version}</version>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <!-- Required for launching the feature tests -->
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-test</artifactId>
+ <version>${odl.commons.opendaylight.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-config/appc-encryption-tool/features/src/main/resources/features.xml b/appc-config/appc-encryption-tool/features/src/main/resources/features.xml
new file mode 100644
index 000000000..ddb1a8526
--- /dev/null
+++ b/appc-config/appc-encryption-tool/features/src/main/resources/features.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+
+<features name="appc-config-encryption-tool-${project.version}"
+ xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.version}/xml/features</repository>
+
+ <feature name='appc-config-encryption-tool' description="Application Controller Encription Tool"
+ version='${project.version}'>
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <feature version="${broker-mdsal.version}">odl-mdsal-broker</feature>
+
+ <feature version="${sdnctl.dblib.version}">sdnc-dblib</feature>
+ <feature version="${sdnctl.sli.version}">sdnc-sli</feature>
+ <feature version="${openecomp.sdnc.sql-resource.version}">sdnc-sql-resource</feature>
+
+ <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+ <bundle>mvn:org.apache.velocity/velocity/${velocity.version}</bundle>
+ <bundle>mvn:commons-collections/commons-collections/${common.collections.version}</bundle>
+ <bundle>wrap:mvn:commons-configuration/commons-configuration/1.10</bundle>
+ <bundle>wrap:mvn:org.jasypt/jasypt/1.9.2</bundle>
+ <bundle>mvn:mysql/mysql-connector-java/${mysql.connector.version}</bundle>
+ <bundle>wrap:mvn:com.att.eelf/eelf-core/${eelf.version}</bundle>
+ <bundle>mvn:ch.qos.logback/logback-core/${logback.version}</bundle>
+ <bundle>mvn:ch.qos.logback/logback-classic/${logback.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-config-encryption-tool-provider/${project.version}</bundle>
+ </feature>
+</features>
diff --git a/appc-config/appc-encryption-tool/installer/pom.xml b/appc-config/appc-encryption-tool/installer/pom.xml
new file mode 100644
index 000000000..03e483e78
--- /dev/null
+++ b/appc-config/appc-encryption-tool/installer/pom.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017 Amdocs
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-encryption-tool</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>appc-config-encryption-tool-installer</artifactId>
+ <name>Config Component Encryption Tool - Installer</name>
+ <packaging>pom</packaging>
+ <properties>
+ <application.name>appc-config-encryption-tool</application.name>
+ <features.boot>appc-config-encryption-tool</features.boot>
+ <features.repositories>mvn:org.openecomp.appc/appc-config-encryption-tool-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-encryption-tool-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-encryption-tool-provider</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>installer-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>false</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <excludeGroupIds>org.opendaylight</excludeGroupIds>
+ <scope>provided</scope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-version</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources/scripts</directory>
+ <includes>
+ <include>install-feature.sh</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-config/appc-encryption-tool/installer/src/assembly/assemble_installer_zip.xml b/appc-config/appc-encryption-tool/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 000000000..3b8fe894a
--- /dev/null
+++ b/appc-config/appc-encryption-tool/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,59 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>encryption-tool</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>755</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>644</fileMode>
+ <excludes>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+
+</assembly>
diff --git a/appc-config/appc-encryption-tool/installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-config/appc-encryption-tool/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..98e1b9a9d
--- /dev/null
+++ b/appc-config/appc-encryption-tool/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,47 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>encryption-tool</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+</assembly>
diff --git a/appc-config/appc-encryption-tool/installer/src/main/resources/scripts/install-feature.sh b/appc-config/appc-encryption-tool/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 000000000..b8e924279
--- /dev/null
+++ b/appc-config/appc-encryption-tool/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APP-C
+# ================================================================================
+# Copyright (C) 2017 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+###
+
+#!/bin/bash
+
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
+ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+INSTALLERDIR=$(dirname $0)
+
+REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip
+
+if [ -f ${REPOZIP} ]
+then
+ unzip -n -d ${ODL_HOME} ${REPOZIP}
+else
+ echo "ERROR : repo zip ($REPOZIP) not found"
+ exit 1
+fi
+
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
diff --git a/appc-config/appc-encryption-tool/pom.xml b/appc-config/appc-encryption-tool/pom.xml
new file mode 100644
index 000000000..2e8e24419
--- /dev/null
+++ b/appc-config/appc-encryption-tool/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <artifactId>appc-config-encryption-tool</artifactId>
+
+ <name>APPC Encryption Tool</name>
+ <description>Common Utilities for DG</description>
+
+ <properties>
+ <sdnctl.sql.resource.version>${sdnctl.sli.version}</sdnctl.sql.resource.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <mysql.connector.version>5.1.39</mysql.connector.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-encryption-tool-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-encryption-tool-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <modules>
+ <module>provider</module>
+ <module>features</module>
+ <module>installer</module>
+ </modules>
+
+</project>
diff --git a/appc-config/appc-encryption-tool/provider/.gitignore b/appc-config/appc-encryption-tool/provider/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-encryption-tool/provider/appc_southbound.properties b/appc-config/appc-encryption-tool/provider/appc_southbound.properties
new file mode 100644
index 000000000..2ef508203
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/appc_southbound.properties
@@ -0,0 +1,4 @@
+testVnf_Type.testAction1.user =
+testVnf_Type.testAction1.port =
+testVnf_Type.testAction1.password =
+testVnf_Type.testAction1.url =
diff --git a/appc-config/appc-encryption-tool/provider/pom.xml b/appc-config/appc-encryption-tool/provider/pom.xml
new file mode 100644
index 000000000..6c48ada8b
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-encryption-tool</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-config-encryption-tool-provider</artifactId>
+ <packaging>bundle</packaging>
+ <name>APPC Encryption Tool - Provider</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>${equinox.osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.adaptors</groupId>
+ <artifactId>sql-resource-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jasypt</groupId>
+ <artifactId>jasypt</artifactId>
+ <version>1.9.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${bundle.plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.openecomp.appc.encryptiontool</Bundle-SymbolicName>
+ <Bundle-Activator>org.openecomp.appc.encryptiontool.EncryptionToolActivator</Bundle-Activator>
+ <Export-Package>org.openecomp.appc.encryptiontool</Export-Package>
+ <Import-Package>*</Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/EncryptionToolActivator.java b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/EncryptionToolActivator.java
new file mode 100644
index 000000000..002450114
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/EncryptionToolActivator.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.encryptiontool;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.openecomp.appc.encryptiontool.wrapper.EncryptionToolDGWrapper;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class EncryptionToolActivator implements BundleActivator {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(EncryptionToolActivator.class);
+ private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+
+ @Override
+ public void start(BundleContext ctx) throws Exception {
+ EncryptionToolDGWrapper encryptionToolWrapper = new EncryptionToolDGWrapper();
+ log.info("Registering service-- " + encryptionToolWrapper.getClass().getName());
+ registrations.add(ctx.registerService(encryptionToolWrapper.getClass().getName(), encryptionToolWrapper, null));
+
+ }
+
+ @Override
+ public void stop(BundleContext arg0) throws Exception {
+ for (ServiceRegistration registration : registrations) {
+ registration.unregister();
+ registration = null;
+ }
+ }
+}
diff --git a/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/Constants.java b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/Constants.java
new file mode 100644
index 000000000..710b61a43
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/Constants.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.encryptiontool.wrapper;
+
+public class Constants
+{
+
+ public static final String DBLIB_SERVICE = "org.openecomp.sdnctl.sli.resource.dblib.DBResourceManager";
+ public static final String DEVICE_AUTHENTICATION="DEVICE_AUTHENTICATION";
+ public static final String SCHEMA_SDNCTL="SDNCTL";
+
+ private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR";
+
+ public static final String APPC_CONFIG_DIR="/opt/app/bvc/properties";
+}
diff --git a/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/DbServiceUtil.java b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/DbServiceUtil.java
new file mode 100644
index 000000000..4f7630478
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/DbServiceUtil.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.encryptiontool.wrapper;
+
+import java.io.File;
+import java.net.URL;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import javax.sql.rowset.CachedRowSet;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.openecomp.sdnc.sli.resource.dblib.DBResourceManager;
+import org.openecomp.sdnc.sli.resource.dblib.DbLibService;
+
+public class DbServiceUtil
+{
+ private static final Logger log = LoggerFactory
+ .getLogger(DbServiceUtil.class);
+
+ private static Properties props;
+ private static DBResourceManager jdbcDataSource = null;
+
+ public static boolean updateDB(String tableName, ArrayList inputArgs,
+ String scema, String whereClause, String setCluase) throws SQLException
+ {
+ String updatePasswordString = "update " + tableName + " set " + setCluase + " where " + whereClause ;
+ boolean result = jdbcDataSource.writeData(updatePasswordString, inputArgs,Constants.SCHEMA_SDNCTL);
+ return result;
+ }
+
+ public static CachedRowSet getData(String tableName, ArrayList argList, String schema,
+ String getselectData, String getDataClasue ) throws SQLException
+ {
+ String selectQuery = "select " + getselectData + "from " + tableName + " where " + getDataClasue ;
+ CachedRowSet data = jdbcDataSource.getData(selectQuery, argList, schema);
+ return data;
+ }
+
+
+ public static DBResourceManager initDbLibService() throws Exception
+ {
+ props = new Properties();
+ File file = new File("/opt/app/bvc/properties/dblib.properties");
+ URL propURL = file.toURI().toURL();
+ props.load(propURL.openStream());
+ jdbcDataSource = DBResourceManager.create(props);
+ return jdbcDataSource;
+ }
+
+}
diff --git a/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/EncryptionTool.java b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/EncryptionTool.java
new file mode 100644
index 000000000..3a1b25ffa
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/EncryptionTool.java
@@ -0,0 +1,214 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.encryptiontool.wrapper;
+
+import java.security.Provider;
+import java.security.Provider.Service;
+import java.security.Security;
+
+import javax.crypto.Cipher;
+
+import org.jasypt.contrib.org.apache.commons.codec_1_3.binary.Base64;
+import org.jasypt.util.text.BasicTextEncryptor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is used to encapsulate the encryption and decryption support in one place and to provide a utility to
+ * encrypt and decrypt data.
+ */
+public class EncryptionTool {
+
+ /**
+ * This lock object is used ONLY if the singleton has not been set up.
+ */
+ private static final Object lock = new Object();
+
+ /**
+ * The salt is used to initialize the PBE (password Based Encrpytion) algorithm.
+ */
+ private static final byte[] DEFAULT_SALT = {
+ (byte) 0xc7, (byte) 0x73, (byte) 0x21, (byte) 0x8c, (byte) 0x7e, (byte) 0xc8, (byte) 0xee, (byte) 0x99
+ };
+
+ /**
+ * The prefix we insert onto any data we encrypt so that we can tell if it is encrpyted later and therefore decrypt
+ * it
+ */
+ @SuppressWarnings("nls")
+ public static final String ENCRYPTED_VALUE_PREFIX = "enc:";
+
+ /**
+ * The instance of the encryption utility object
+ */
+ private static EncryptionTool instance = null;
+
+ /**
+ * The iteration count used to initialize the PBE algorithm and to generate the key spec
+ */
+ private static final int ITERATION_COUNT = 20;
+
+ /**
+ * The logger for this class.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(EncryptionTool.class);
+
+ /**
+ * The secret passphrase (PBE) that we use to perform encryption and decryption. The algorithm we are using is a
+ * symmetrical cipher.
+ */
+ private static char[] secret = {
+ 'C', '_', 'z', 'l', '!', 'K', '!', '4', '?', 'O', 'z', 'E', 'K', 'E', '>', 'U', 'R', '/', '%', 'Y', '\\', 'f',
+ 'b', '"', 'e', 'n', '{', '"', 'l', 'U', 'F', '+', 'E', '\'', 'R', 'T', 'p', '1', 'V', '4', 'l', 'a', '9', 'w',
+ 'v', '5', 'Z', '#', 'i', 'V', '"', 'd', 'l', '!', 'L', 'M', 'g', 'L', 'Q', '{', 'v', 'v', 'K', 'V'
+ };
+
+ /**
+ * The algorithm to encrypt and decrpyt data is "Password (or passphrase) Based Encryption with Message Digest #5
+ * and the Data Encryption Standard", i.e., PBEWithMD5AndDES.
+ */
+ @SuppressWarnings("nls")
+ private static final String SECURITY_ALGORITHM = "PBEWITHMD5AND256BITAES";// "PBEWithMD5AndDES";
+
+ /**
+ * The decryption cipher object
+ */
+ private Cipher decryptCipher = null;
+
+ /**
+ * The encryption cipher object
+ */
+ private Cipher encryptCipher = null;
+
+ private BasicTextEncryptor encryptor;
+
+ /**
+ * Get an instance of the EncryptionTool
+ *
+ * @return The encryption tool to be used
+ */
+ public static final EncryptionTool getInstance() {
+ if (instance == null) {
+ synchronized (lock) {
+ if (instance == null) {
+ instance = new EncryptionTool();
+ }
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Create the EncryptionTool instance
+ */
+ @SuppressWarnings("nls")
+ private EncryptionTool() {
+ // encryptor = new BasicTextEncryptor();
+ // encryptor.setPassword(secret.toString());
+ String out = "Found the following security algorithms:";
+ for (Provider p : Security.getProviders()) {
+ for (Service s : p.getServices()) {
+ String algo = s.getAlgorithm();
+ out +=
+ String.format("\n -Algorithm [ %s ] in provider [ %s ] and service [ %s ]", algo, p.getName(),
+ s.getClassName());
+ }
+ }
+ LOG.debug(out);
+ }
+
+ /**
+ * Decrypt the provided encrypted text
+ *
+ * @param cipherText
+ * THe cipher text to be decrypted. If the ciphertext is not encrypted, then it is returned as is.
+ * @return the clear test of the (possibly) encrypted value. The original value if the string is not encrypted.
+ */
+ @SuppressWarnings("nls")
+ public synchronized String decrypt(String cipherText) {
+ if (isEncrypted(cipherText)) {
+ String encValue = cipherText.substring(ENCRYPTED_VALUE_PREFIX.length());
+ // return encryptor.decrypt(encValue);
+ byte[] plainByte = Base64.decodeBase64(encValue.getBytes());
+ byte[] decryptByte = xorWithSecret(plainByte);
+ return new String(decryptByte);
+ } else {
+ return cipherText;
+ }
+
+ }
+
+ /**
+ * Encrypt the provided clear text
+ *
+ * @param clearText
+ * The clear text to be encrypted
+ * @return the encrypted text. If the clear text is empty (null or zero length), then an empty string is returned.
+ * If the clear text is already encrypted, it is not encrypted again and is returned as is. Otherwise, the
+ * clear text is encrypted and returned.
+ */
+ @SuppressWarnings("nls")
+ public synchronized String encrypt(String clearText) {
+ if (clearText != null) {
+ byte[] encByte = xorWithSecret(clearText.getBytes());
+ String encryptedValue = new String(Base64.encodeBase64(encByte));
+ return ENCRYPTED_VALUE_PREFIX + encryptedValue;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Is a value encrypted? A value is considered to be encrypted if it begins with the
+ * {@linkplain #ENCRYPTED_VALUE_PREFIX encrypted value prefix}.
+ *
+ * @param value
+ * the value to check.
+ * @return true/false;
+ */
+ private static boolean isEncrypted(final String value) {
+ return value != null && value.startsWith(ENCRYPTED_VALUE_PREFIX);
+ }
+
+ /**
+ * XORs the input byte array with the secret key, padding 0x0 to the end of the secret key if the input is longer
+ * and returns a byte array the same size as input
+ *
+ * @param inp
+ * The byte array to be XORed with secret
+ * @return A byte array the same size as inp or null if input is null.
+ */
+ private byte[] xorWithSecret(byte[] inp) {
+ if (inp == null) {
+ return null;
+ }
+
+ byte[] secretBytes = new String(secret).getBytes();
+ int size = inp.length;
+
+ byte[] out = new byte[size];
+ for (int i = 0; i < size; i++) {
+ out[i] = (byte) ((inp[i]) ^ (secretBytes[i % secretBytes.length]));
+ }
+ return out;
+ }
+
+}
diff --git a/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/EncryptionToolDGWrapper.java b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/EncryptionToolDGWrapper.java
new file mode 100644
index 000000000..3dde4e5c0
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/EncryptionToolDGWrapper.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.encryptiontool.wrapper;
+
+import java.util.Map;
+
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.lang.StringUtils;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+public class EncryptionToolDGWrapper implements SvcLogicJavaPlugin {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(EncryptionToolDGWrapper.class);
+
+ public void runEncryption(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException
+ {
+ String responsePrefix = inParams.get("prefix");
+ String userName = inParams.get("userName");
+ String password = inParams.get("password");
+ String vnf_type = inParams.get("vnf_type");
+
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "" ;
+ if(StringUtils.isBlank(userName) || StringUtils.isBlank(password) || StringUtils.isBlank(vnf_type)){
+ throw new Exception("username or Password is missing");
+ }
+
+ String [] input = new String[] {vnf_type,userName,password};
+ WrapperEncryptionTool.main(input);
+ }
+ catch (Exception e)
+ {
+ throw new SvcLogicException(e.getMessage());
+ }
+
+ }
+ public void getProperty(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException
+ {
+ String responsePrefix = inParams.get("prefix");
+ String propertyName = inParams.get("propertyName");
+
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "" ;
+ PropertiesConfiguration conf = new PropertiesConfiguration(Constants.APPC_CONFIG_DIR + "/appc_southbound.properties");
+ conf.setBasePath(null);
+ EncryptionTool et = EncryptionTool.getInstance();
+
+ ctx.setAttribute(responsePrefix + "propertyName", et.decrypt(conf.getProperty(propertyName).toString()));
+ }
+ catch (Exception e) {
+ ctx.setAttribute(responsePrefix + "status", "failure");
+ ctx.setAttribute(responsePrefix + "error-message", e.getMessage());
+ e.printStackTrace();
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+}
diff --git a/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/WrapperEncryptionTool.java b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/WrapperEncryptionTool.java
new file mode 100644
index 000000000..aa86149aa
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/src/main/java/org/openecomp/appc/encryptiontool/wrapper/WrapperEncryptionTool.java
@@ -0,0 +1,142 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.encryptiontool.wrapper;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import javax.sql.rowset.CachedRowSet;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.openecomp.sdnc.sli.resource.dblib.DBResourceManager;
+
+public class WrapperEncryptionTool {
+
+ private static final Logger log = LoggerFactory
+ .getLogger(WrapperEncryptionTool.class);
+
+ public static void main(String[] args)
+ {
+ int rowCount = 0;
+ String vnf_type=args[0];
+ String user = args[1];
+ String password = args[2];
+ String action = args[3];
+ String port = args[4];
+ String url = args[5];
+
+ if("".equals(vnf_type))
+ {
+ System.out.println("ERROR-VNF_TYPE can not be null");
+ return;
+ }
+ if("".equals(user))
+ {
+ System.out.println("ERROR-USER can not be null");
+ return;
+ }
+ if("".equals(password))
+ {
+ System.out.println("ERROR-PASSWORD can not be null");
+ return;
+ }
+
+ EncryptionTool encryptionTool = EncryptionTool.getInstance();
+ String enPass = encryptionTool.encrypt(password);
+
+ if(action != null && !action.isEmpty()){
+ updateProperties(user,vnf_type , enPass, action, port, url);
+ return ;
+ }
+
+ ArrayList<String> argList = new ArrayList<>();
+ argList.add(vnf_type);
+ argList.add(user);
+ String clause = " vnf_type = ? and user_name = ? ";
+ String setClause = " password = ? ";
+ String getselectData = " * ";
+ DBResourceManager dbResourceManager = null;
+ try
+ {
+ dbResourceManager = DbServiceUtil.initDbLibService();
+ CachedRowSet data = DbServiceUtil.getData(Constants.DEVICE_AUTHENTICATION,
+ argList, Constants.SCHEMA_SDNCTL, getselectData,clause );
+ while(data.next())
+ {
+ rowCount ++;
+ }
+ if(rowCount == 0)
+ log.info("APPC-MESSAGE: ERROR - No record Found for VNF_TYPE: " + vnf_type + ", User " + user );
+ else
+ {
+ argList.clear();
+ argList.add(enPass);
+ argList.add(vnf_type);
+ argList.add(user);
+ DbServiceUtil.updateDB(Constants.DEVICE_AUTHENTICATION, argList,
+ Constants.SCHEMA_SDNCTL, clause, setClause);
+ log.info("APPC-MESSAGE: Password Updated Successfully");
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ log.info("APPC-MESSAGE:" + e.getMessage());
+ }
+ finally
+ {
+ dbResourceManager.cleanUp();
+ System.exit(0);
+ }
+ }
+
+ private static void updateProperties(String user, String vnf_type, String password,
+ String action, String port, String url) {
+
+ log.info("Received Inputs User:" + user + " vnf_type:" + vnf_type + " action:" + action );
+
+ String property = vnf_type + "." + action + ".";
+
+ try {
+ PropertiesConfiguration conf = new PropertiesConfiguration(Constants.APPC_CONFIG_DIR + "/appc_southbound.properties");
+ conf.setProperty(property + "user", user);
+ if(port != null && !port.isEmpty() )
+ conf.setProperty(property + "port", port);
+ if(password != null && !password.isEmpty() )
+ conf.setProperty(property + "password", password);
+ if(url != null && !url.isEmpty() )
+ conf.setProperty(property + "url", url);
+
+ conf.save();
+
+ }
+ catch (Exception e ) {
+ e.printStackTrace();
+ log.info("APPC-MESSAGE:" + e.getMessage());
+ }
+
+ }
+}
diff --git a/appc-config/appc-encryption-tool/provider/src/test/java/org/openecomp/appc/encryptiontool/TestEncryptionTool.java b/appc-config/appc-encryption-tool/provider/src/test/java/org/openecomp/appc/encryptiontool/TestEncryptionTool.java
new file mode 100644
index 000000000..3811be34a
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/src/test/java/org/openecomp/appc/encryptiontool/TestEncryptionTool.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.encryptiontool;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.openecomp.appc.encryptiontool.wrapper.EncryptionToolDGWrapper;
+import org.openecomp.appc.encryptiontool.wrapper.WrapperEncryptionTool;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class TestEncryptionTool {
+
+ //@Test
+ public void testEncryptionTool() throws Exception{
+
+ String [] input = new String[] {"testVnf_Type","testUser","testPassword11", "testAction1", "8080", "http://localhost:8080/restconf/healthcheck"};
+ WrapperEncryptionTool.main(input);
+
+ }
+ //@Test
+ public void testgetPropertyDG() throws Exception{
+ EncryptionToolDGWrapper encryptionToolDBWrapper = new EncryptionToolDGWrapper();
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> inParams = new HashMap<String, String>();
+
+ inParams.put("prefix", "test");
+ inParams.put("propertyName", "testVnf_Type.testAction1.url");
+
+ encryptionToolDBWrapper.getProperty(inParams, ctx);
+
+ System.out.println("propertyValue :" + ctx.getAttribute("test.propertyName"));
+
+ System.out.println("All propertyValue :" + ctx.getAttributeKeySet());
+ }
+
+}
diff --git a/appc-config/appc-encryption-tool/provider/src/test/resources/svclogic.properties b/appc-config/appc-encryption-tool/provider/src/test/resources/svclogic.properties
new file mode 100644
index 000000000..ba3e9b820
--- /dev/null
+++ b/appc-config/appc-encryption-tool/provider/src/test/resources/svclogic.properties
@@ -0,0 +1,33 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APP-C
+# ================================================================================
+# Copyright (C) 2017 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+com.att.sdnctl.sli.dbtype=
+com.att.sdnctl.sli.jdbc.hosts=
+com.att.sdnctl.sli.jdbc.url=
+com.att.sdnctl.sli.jdbc.database=
+com.att.sdnctl.sli.jdbc.user=
+com.att.sdnctl.sli.jdbc.password=
+com.att.sdnctl.sli.jdbc.connection.name=
+
+com.att.sdnctl.sli.jdbc.connection.timeout=
+com.att.sdnctl.sli.jdbc.request.timeout=
+com.att.sdnctl.sli.jdbc.limit.init=
+com.att.sdnctl.sli.jdbc.limit.min=
+com.att.sdnctl.sli.jdbc.limit.max=
diff --git a/appc-config/pom.xml b/appc-config/pom.xml
index 93d2ca3d9..14c844d3c 100644
--- a/appc-config/pom.xml
+++ b/appc-config/pom.xml
@@ -23,7 +23,7 @@
<common.io.version>2.5</common.io.version>
<sdnc.sql.resource.version>1.1.0</sdnc.sql.resource.version>
- <openecomp.sdnc.sql-resource.version>1.1.0</openecomp.sdnc.sql-resource.version>
+ <openecomp.sdnc.sql-resource.version>1.1.2</openecomp.sdnc.sql-resource.version>
<sdnc.sli.version>1.1.0</sdnc.sli.version>
<tosca.datatype.version>1.1.0</tosca.datatype.version>
</properties>
@@ -89,6 +89,7 @@
<modules>
<module>appc-config-params</module>
+ <module>appc-encryption-tool</module>
</modules>
</project>