import java.security.GeneralSecurityException;
import java.security.KeyStore;
+/**
+ * @deprecated org.onap.dcaegen2.services.sdk.security.ssl.SslFactory should be used instead
+ */
+@Deprecated
public class SslFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(SslFactory.class);
<modules>
<module>crypt-password</module>
+ <module>ssl</module>
</modules>
</project>
\ No newline at end of file
--- /dev/null
+<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.onap.dcaegen2.services.sdk.security</groupId>
+ <artifactId>dcaegen2-services-sdk-security</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>ssl</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+
+ <name>SSL</name>
+ <description>Common SSL-related Classes Library</description>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.projectreactor.netty</groupId>
+ <artifactId>reactor-netty</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.immutables</groupId>
+ <artifactId>value</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.vavr</groupId>
+ <artifactId>vavr</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains</groupId>
+ <artifactId>annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
* ============LICENSE_END=====================================
*/
-package org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options;
+package org.onap.dcaegen2.services.sdk.security.ssl;
import io.vavr.CheckedFunction1;
import io.vavr.Function1;
import io.vavr.control.Try;
-import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import org.jetbrains.annotations.NotNull;
* ============LICENSE_END=====================================
*/
-package org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options;
+package org.onap.dcaegen2.services.sdk.security.ssl;
import io.vavr.control.Try;
import java.io.File;
* ============LICENSE_END=====================================
*/
-package org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options;
+package org.onap.dcaegen2.services.sdk.security.ssl;
import java.nio.file.Path;
import org.immutables.value.Value;
* ============LICENSE_END=====================================
*/
-package org.onap.dcaegen2.services.sdk.services.hvves.client.producer.impl;
+package org.onap.dcaegen2.services.sdk.security.ssl;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
-import io.vavr.Tuple;
+import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import io.vavr.control.Try;
import java.io.IOException;
import java.nio.file.Files;
import java.security.KeyStore;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.TrustManagerFactory;
-import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options.Password;
-import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options.SecurityKeys;
-/*
- * TODO: To be merged with org.onap.dcaegen2.services.sdk.rest.services.ssl.SslFactory
- */
public class SslFactory {
/**
ks.load(Files.newInputStream(path, StandardOpenOption.READ), keyStorePassword);
return ks;
}
-}
\ No newline at end of file
+
+ /**
+ * Function for creating insecure ssl context.
+ *
+ * @return configured insecure ssl context
+ */
+ public Try<SslContext> createInsecureContext() {
+ return Try.success(SslContextBuilder.forClient())
+ .map(ctx -> ctx.trustManager(InsecureTrustManagerFactory.INSTANCE))
+ .mapTry(SslContextBuilder::build);
+ }
+}
* ============LICENSE_END=====================================
*/
-package org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options;
+package org.onap.dcaegen2.services.sdk.security.ssl;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* ============LICENSE_END=====================================
*/
-package org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options;
+package org.onap.dcaegen2.services.sdk.security.ssl;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Fail.fail;
import io.vavr.control.Try;
import java.io.File;
<version>1.1.1-SNAPSHOT</version>
<name>High Volume VES Collector Client :: Producer :: API</name>
- <description></description>
<packaging>jar</packaging>
<dependencies>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.dcaegen2.services.sdk.security</groupId>
+ <artifactId>ssl</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
import org.immutables.value.Value;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys;
/**
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
/**
* Security keys definition used when connecting to the collector.
-
*
* @return security keys definition or null when plain TCP sockets are to be used.
* @since 1.1.1
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
+import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeys;
+import org.onap.dcaegen2.services.sdk.security.ssl.Passwords;
import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.HvVesProducer;
import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.HvVesProducerFactory;
import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options.ImmutableProducerOptions;
import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options.ImmutableProducerOptions.Builder;
-import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options.ImmutableSecurityKeys;
-import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options.Passwords;
import org.onap.ves.VesEventOuterClass.VesEvent;
import reactor.core.publisher.Flux;
<version>1.1.1-SNAPSHOT</version>
<name>High Volume VES Collector Client :: Producer :: Implementation</name>
- <description></description>
<packaging>jar</packaging>
<dependencies>
import io.netty.handler.ssl.SslContext;
import org.jetbrains.annotations.NotNull;
+import org.onap.dcaegen2.services.sdk.security.ssl.SslFactory;
import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.HvVesProducer;
import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.HvVesProducerFactory;
import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options.ProducerOptions;