Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add security utils and cert generating functionality #151

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<maven.surefire.version>3.3.1</maven.surefire.version>
<jackson-dataformat-yaml.version>2.17.2</jackson-dataformat-yaml.version>
<org.eclipse.sisu.version>0.9.0.M3</org.eclipse.sisu.version>
<bouncycastle.version>1.78.1</bouncycastle.version>

<it.skip>true</it.skip>
<!--suppress UnresolvedMavenProperty -->
Expand Down Expand Up @@ -221,6 +222,16 @@
<artifactId>org.eclipse.sisu.inject</artifactId>
<version>${org.eclipse.sisu.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
8 changes: 8 additions & 0 deletions test-frame-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@
<artifactId>log4j-slf4j2-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public interface TestFrameConstants {
*/
long GLOBAL_STABILITY_TIME = Duration.ofMinutes(1).toMillis();

/**
* CA validity delay
*/
long CA_CERT_VALIDITY_DELAY = 10;

/**
* Poll interval for resource readiness
*/
long POLL_INTERVAL_FOR_RESOURCE_READINESS = Duration.ofSeconds(1).toMillis();

/**
* OpenShift client type.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright Skodjob authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package io.skodjob.testframe.security;

import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.cert.X509Certificate;

/**
* Record for certificate and key in memory
*
* @param certificate certificate
* @param privateKey key
*/
public record CertAndKey(X509Certificate certificate, PrivateKey privateKey) {

/**
* Returns certificate
*
* @return certificate
*/
public X509Certificate getCertificate() {
return certificate;
}

/**
* Returns public key
*
* @return public key
*/
public PublicKey getPublicKey() {
return certificate.getPublicKey();
}

/**
* Returns private key
*
* @return private key
*/
public PrivateKey getPrivateKey() {
return privateKey;
}
}
Loading
Loading