<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.aaa</groupId>
<artifactId>aaa-cert</artifactId>
- <version>0.8.0-SNAPSHOT</version>
<name>ODL :: aaa :: ${project.artifactId}</name>
<packaging>bundle</packaging>
<groupId>org.opendaylight.aaa</groupId>
<artifactId>aaa-encrypt-service</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-text</artifactId>
+ </dependency>
<!-- Bouncy Castle dependency -->
<dependency>
--- /dev/null
+<?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.opendaylight.aaa</groupId>
+ <artifactId>aaa-parent</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-encrypt-service</artifactId>
+ <name>ODL :: aaa :: ${project.artifactId}</name>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.sshd</groupId>
+ <artifactId>sshd-core</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2016, 2017 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.aaa.encrypt;
+
+/**
+ * A generic encryption/decryption service for encrypting various data in ODL.
+ *
+ * @author - Sharon Aicler (saichler@gmail.com)
+ */
+public interface AAAEncryptionService {
+
+ /**
+ * Encrypt <code>data</code> using a 2-way encryption mechanism.
+ *
+ * @param data plaintext data
+ * @return an encrypted representation of <code>data</code>
+ */
+ String encrypt(String data);
+
+ /**
+ * Encrypt <code>data</code> using a 2-way encryption mechanism.
+ *
+ * @param data plaintext data
+ * @return an encrypted representation of <code>data</code>
+ */
+ byte[] encrypt(byte[] data);
+
+ /**
+ * Decrypt <code>data</code> using a 2-way decryption mechanism.
+ *
+ * @param encryptedData encrypted data
+ * @return plaintext <code>data</code>
+ */
+ String decrypt(String encryptedData);
+
+ /**
+ * Decrypt <code>data</code> using a 2-way decryption mechanism.
+ *
+ * @param encryptedData encrypted data
+ * @return plaintext <code>data</code>
+ */
+ byte[] decrypt(byte[] encryptedData);
+}
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder;
+/**
+ * PKI related utilities.
+ */
+@Deprecated // TODO: abstract a service
public class PKIUtil {
private static final String KEY_FACTORY_TYPE_RSA = "RSA";
private static final String KEY_FACTORY_TYPE_DSA = "DSA";
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © Inocybe Technologies and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<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.opendaylight.aaa</groupId>
+ <artifactId>aaa-parent</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-encrypt-service-impl</artifactId>
+ <name>ODL :: aaa :: ${project.artifactId}</name>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-encrypt-service</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.dependencymanager</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-text</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sshd</groupId>
+ <artifactId>sshd-core</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-support</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package/>
+ </instructions>
+ </configuration>
+ </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/initial/aaa-encrypt-service-config.xml</file>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.encrypt;
+package org.opendaylight.aaa.encrypt.impl;
import java.io.File;
import java.io.IOException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.commons.lang3.RandomStringUtils;
+import org.opendaylight.aaa.encrypt.AAAEncryptionService;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.config.aaa.authn.encrypt.service.config.rev160915.AaaEncryptServiceConfig;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
-/*
- * @author - Sharon Aicler (saichler@gmail.com)
+/**
+ * Provides a basic encryption service implementation with configuration knobs.
+ *
+ * @author - Sharon Aicler (saichler@gmail.com)
*/
@Deprecated
public class AAAEncryptionServiceImpl implements AAAEncryptionService {
}
@Override
- public String decrypt(String encData) {
- if (key == null || encData == null || encData.length() == 0) {
- LOG.warn("String {} was not decrypted.", encData);
- return encData;
+ public String decrypt(String encryptedData) {
+ if (key == null || encryptedData == null || encryptedData.length() == 0) {
+ LOG.warn("String {} was not decrypted.", encryptedData);
+ return encryptedData;
}
try {
- byte[] cryptobytes = DatatypeConverter.parseBase64Binary(encData);
+ byte[] cryptobytes = DatatypeConverter.parseBase64Binary(encryptedData);
byte[] clearbytes = decryptCipher.doFinal(cryptobytes);
return new String(clearbytes, Charset.defaultCharset());
} catch (IllegalBlockSizeException | BadPaddingException e) {
LOG.error("Failed to decrypt encoded data", e);
}
- return encData;
+ return encryptedData;
}
@Override
- public byte[] decrypt(byte[] encData) {
- if (encData == null) {
- LOG.warn("encData is null.");
- return encData;
+ public byte[] decrypt(byte[] encryptedData) {
+ if (encryptedData == null) {
+ LOG.warn("encryptedData is null.");
+ return encryptedData;
}
try {
- return decryptCipher.doFinal(encData);
+ return decryptCipher.doFinal(encryptedData);
} catch (IllegalBlockSizeException | BadPaddingException e) {
LOG.error("Failed to decrypt encoded data", e);
}
- return encData;
+ return encryptedData;
}
private void updateEncrySrvConfig(String newPwd, String newSalt) {
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.encrypt;
+package org.opendaylight.aaa.encrypt.impl;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
binding-class="org.opendaylight.yang.gen.v1.config.aaa.authn.encrypt.service.config.rev160915.AaaEncryptServiceConfig">
</odl:clustered-app-config>
- <bean id="encryptService" class="org.opendaylight.aaa.encrypt.AAAEncryptionServiceImpl">
+ <bean id="encryptService" class="org.opendaylight.aaa.encrypt.impl.AAAEncryptionServiceImpl">
<argument ref="encryptConfig"/>
<argument ref="dataBroker"/>
</bean>
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.aaa.encrypt;
+package org.opendaylight.aaa.encrypt.impl;
import static org.mockito.Mockito.mock;
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2018 Inocybe Technologies and others. All rights reserved.
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
<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">
+ 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.opendaylight.aaa</groupId>
- <artifactId>aaa-parent</artifactId>
- <version>0.8.0-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>odlparent</artifactId>
+ <version>3.1.0</version>
+ <relativePath/>
</parent>
<groupId>org.opendaylight.aaa</groupId>
- <artifactId>aaa-encrypt-service</artifactId>
+ <artifactId>aaa-encryption-service-aggregator</artifactId>
<version>0.8.0-SNAPSHOT</version>
<name>ODL :: aaa :: ${project.artifactId}</name>
- <packaging>bundle</packaging>
+ <packaging>pom</packaging>
- <dependencies>
- <!--Yang Binding -->
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.dependencymanager</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-text</artifactId>
- </dependency>
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcpkix-jdk15on</artifactId>
- </dependency>
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk15on</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- <version>1.6.0</version>
- </dependency>
- <!-- Testing Dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-support</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ </modules>
- <build>
- <plugins>
- <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/initial/aaa-encrypt-service-config.xml</file>
- <type>xml</type>
- <classifier>config</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <!-- override default version so we don't use bnd 2.3.0 when embedding sqlite -->
- <extensions>true</extensions>
- <configuration>
- </configuration>
- </plugin>
- </plugins>
- </build>
</project>
+++ /dev/null
-/*
- * Copyright (c) 2016, 2017 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.aaa.encrypt;
-
-/*
- * @author - Sharon Aicler (saichler@gmail.com)
- */
-
-public interface AAAEncryptionService {
-
- String encrypt(String data);
-
- byte[] encrypt(byte[] data);
-
- String decrypt(String encData);
-
- byte[] decrypt(byte[] encData);
-}
<artifactId>aaa-encrypt-service</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-encrypt-service-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>aaa-encrypt-service</artifactId>
+ <artifactId>aaa-encrypt-service-impl</artifactId>
<version>${project.version}</version>
<type>xml</type>
<classifier>config</classifier>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>aaa-encrypt-service</artifactId>
- <classifier>config</classifier>
- <type>xml</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>aaa-encrypt-service</artifactId>
+ <artifactId>aaa-encrypt-service-impl</artifactId>
+ <classifier>config</classifier>
+ <type>xml</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<groupId>${project.groupId}</groupId>
<artifactId>aaa-filterchain</artifactId>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>aaa-password-service-api</artifactId>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>aaa-shiro-api</artifactId>
<classifier>features</classifier>
<type>xml</type>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}.web</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}.web</groupId>
+ <artifactId>servlet-jersey2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}.web</groupId>
+ <artifactId>web-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}.web</groupId>
+ <artifactId>web-osgi-impl</artifactId>
+ </dependency>
</dependencies>
<name>ODL :: aaa :: ${project.artifactId}</name>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>aaa-artifacts</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<!-- MD-SAL -->
<dependency>
<dependency>
<groupId>org.opendaylight.aaa</groupId>
<artifactId>aaa-encrypt-service</artifactId>
- <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-encrypt-service-impl</artifactId>
</dependency>
<dependency>
<!-- finalname="etc/opendaylight/datastore/initial/config/aaa-encrypt-service-config.xml" -->
<groupId>org.opendaylight.aaa</groupId>
- <artifactId>aaa-encrypt-service</artifactId>
- <version>${project.version}</version>
+ <artifactId>aaa-encrypt-service-impl</artifactId>
<type>xml</type>
<classifier>config</classifier>
</dependency>
<features name="odl-aaa-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0">
<feature name="odl-aaa-encryption-service" version="${project.version}">
<configfile finalname="etc/opendaylight/datastore/initial/config/aaa-encrypt-service-config.xml">
- mvn:org.opendaylight.aaa/aaa-encrypt-service/${project.version}/xml/config
+ mvn:org.opendaylight.aaa/aaa-encrypt-service-impl/${project.version}/xml/config
</configfile>
</feature>
</features>