Skip to content
Open
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
baf0b02
remove bouncycastle
mkleene May 11, 2026
d0f1d76
remove bouncycastle
mkleene May 11, 2026
12aa78b
Merge remote-tracking branch 'origin/remove-bouncycastle' into remove…
mkleene May 11, 2026
a7991ca
we do not need this
mkleene May 11, 2026
21fd9fb
centralize PEM parsing logic
mkleene May 11, 2026
dcb5d17
remove unused imports
mkleene May 11, 2026
9c79376
Apply suggestion from @gemini-code-assist[bot]
mkleene May 11, 2026
c689eb8
extract constant
mkleene May 11, 2026
1a34351
Merge remote-tracking branch 'origin/remove-bouncycastle' into remove…
mkleene May 11, 2026
df105d0
rename
mkleene May 11, 2026
8247667
feat(sdk): replace ayza libraries with TrustProvider on JCA
mkleene May 7, 2026
5b74337
sonarcloud
mkleene May 11, 2026
1a573c7
Merge branch 'remove-bouncycastle' into remove-ayza
mkleene May 11, 2026
6fc81f1
fix provider stuff
mkleene May 11, 2026
827a5c3
make sure we get the right provider in tests
mkleene May 12, 2026
6905740
Merge branch 'remove-bouncycastle' into remove-ayza
mkleene May 12, 2026
d8a14d5
try this way
mkleene May 13, 2026
1bc26db
get ssl working
mkleene May 13, 2026
091d138
Merge branch 'remove-bouncycastle' into remove-ayza
mkleene May 13, 2026
c5f067f
do not need this
mkleene May 13, 2026
db617a5
try configuring things this way
mkleene May 13, 2026
c9733cd
I guess we did not need that either
mkleene May 13, 2026
23d27be
run the tests in FIPS
mkleene May 13, 2026
67543eb
batch mode
mkleene May 13, 2026
19566ee
use the right kind of key manager
mkleene May 13, 2026
83243c7
run fips first so the artifacts stay around
mkleene May 13, 2026
d13b894
Apply suggestion from @coderabbitai[bot]
mkleene May 13, 2026
b8afe5b
ok maybe this works
mkleene May 13, 2026
ac91f95
Merge remote-tracking branch 'origin/remove-ayza' into remove-ayza
mkleene May 13, 2026
a917274
oops
mkleene May 13, 2026
c9b59e4
maybe we do not need this either
mkleene May 13, 2026
f724797
we do need these
mkleene May 13, 2026
bc185f7
fix jacoco
mkleene May 13, 2026
4046710
just get some coverage
mkleene May 13, 2026
6efa0b4
cleanup
mkleene May 14, 2026
46c2888
run the right stuff
mkleene May 14, 2026
697029f
oops
mkleene May 14, 2026
ea23921
just this
mkleene May 14, 2026
8bb808e
this is not allowed by bc in approved mode
mkleene May 14, 2026
4aaad3f
arun all of the modes
mkleene May 14, 2026
7d8642d
do not clean this
mkleene May 14, 2026
f0d0def
sonarcloud
mkleene May 15, 2026
8fd2c0a
create a builder using a trustmanager
mkleene May 15, 2026
e2ec977
rework build a bit
mkleene May 15, 2026
e48dbe3
one more try
mkleene May 15, 2026
1e8cad8
vulnerability
mkleene May 15, 2026
eb1e65a
remove explicit javadoc
mkleene May 15, 2026
874f898
get the path right
mkleene May 16, 2026
4121014
coderabbit
mkleene May 18, 2026
677da79
add overload
mkleene May 18, 2026
fafe689
more explicit
mkleene May 18, 2026
141d52e
coderabbit
mkleene May 18, 2026
8f5d1ed
this does not need to be public
mkleene May 18, 2026
5fdaea0
sonar
mkleene May 19, 2026
89fa4b2
code review feedback
mkleene May 19, 2026
de30fb5
oops
mkleene May 19, 2026
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
16 changes: 13 additions & 3 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,23 @@ jobs:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Maven Test Coverage
- name: Generate sources
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUF_INPUT_HTTPS_USERNAME: opentdf-bot
BUF_INPUT_HTTPS_PASSWORD: ${{ secrets.PERSONAL_ACCESS_TOKEN_OPENTDF }}
run: mvn --batch-mode clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=opentdf_java-sdk -P coverage
run: mvn clean --batch-mode clean generate-sources
- name: Tests and enforcer (fips)
run: mvn --batch-mode test enforcer:enforce -P 'fips,!non-fips' -Dmaven.antrun.skip
- name: Tests with coverage and javadoc (non-fips)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn --batch-mode verify \
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-Dmaven.antrun.skip -Dsonar.projectKey=opentdf_java-sdk \
-P 'coverage,non-fips,!fips'

platform-integration:
runs-on: ubuntu-22.04
Expand Down
14 changes: 9 additions & 5 deletions cmdline/src/main/java/io/opentdf/platform/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;

import java.security.cert.X509Certificate;
import java.text.ParseException;
import com.google.gson.JsonSyntaxException;
import io.opentdf.platform.sdk.AssertionConfig;
Expand All @@ -18,11 +19,11 @@
import io.opentdf.platform.sdk.KeyType;
import io.opentdf.platform.sdk.SDK;
import io.opentdf.platform.sdk.SDKBuilder;
import nl.altindag.ssl.SSLFactory;
import picocli.CommandLine;
import picocli.CommandLine.HelpCommand;
import picocli.CommandLine.Option;

import javax.net.ssl.X509TrustManager;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
Expand Down Expand Up @@ -262,10 +263,13 @@ void encrypt(
private SDK buildSDK() {
SDKBuilder builder = new SDKBuilder();
if (insecure) {
SSLFactory sslFactory = SSLFactory.builder()
.withUnsafeTrustMaterial() // Trust all certificates
.build();
builder.sslFactory(sslFactory);
// Trust all certificates
X509TrustManager insecureTrustManager = new X509TrustManager() {
@Override public void checkClientTrusted(X509Certificate[] chain, String authType) {}
@Override public void checkServerTrusted(X509Certificate[] chain, String authType) {}
@Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; }
};
builder.sslFactoryFromTrustManager(insecureTrustManager);
Comment thread
mkleene marked this conversation as resolved.
Outdated
}

return builder.platformEndpoint(platformEndpoint)
Expand Down
57 changes: 23 additions & 34 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<grpc.version>1.75.0</grpc.version>
<protobuf.version>4.29.2</protobuf.version>
<bouncycastle.version>1.82</bouncycastle.version>
<ayza.version>10.0.0</ayza.version>
<bc-fips.version>2.1.2</bc-fips.version>
<bcpkix-fips.version>2.1.11</bcpkix-fips.version>
<bctls-fips.version>2.1.23</bctls-fips.version>
<bytebuddy.version>1.18.3</bytebuddy.version>
<!-- JaCoCo Properties -->
<jacoco.version>0.8.13</jacoco.version>
Expand Down Expand Up @@ -78,39 +80,6 @@
<version>3.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>ayza-for-pem</artifactId>
<version>${ayza.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>ayza</artifactId>
<version>${ayza.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>ayza-for-netty</artifactId>
<version>${ayza.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
Expand Down Expand Up @@ -157,6 +126,26 @@
<artifactId>bcprov-jdk18on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bctls-jdk18on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bc-fips</artifactId>
<version>${bc-fips.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-fips</artifactId>
<version>${bcpkix-fips.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bctls-fips</artifactId>
<version>${bctls-fips.version}</version>
</dependency>
<!--
Pin Byte Buddy for test-time Mockito instrumentation on newer JVMs (e.g. Java 21).
This does NOT add a runtime dependency; it only manages the version used by modules.
Expand Down
75 changes: 52 additions & 23 deletions sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<connect.version>0.7.2</connect.version>
<okhttp.version>4.12.0</okhttp.version>
<platform.branch>protocol/go/v0.16.0</platform.branch>
<!-- in the non-FIPS case we don't need to pass anything to the jvm -->
<java.security.properties.test></java.security.properties.test>
<!-- Default empty argLine; overridden by jacoco:prepare-agent when the `coverage` profile is active -->
<argLine></argLine>
</properties>
<dependencies>
<!-- Logging Dependencies -->
Expand All @@ -31,18 +35,6 @@
<artifactId>oauth2-oidc-sdk</artifactId>
<version>11.10.1</version>
</dependency>
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>ayza-for-pem</artifactId>
</dependency>
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>ayza</artifactId>
</dependency>
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>ayza-for-netty</artifactId>
</dependency>
<!-- Serialization and Deserialization Dependencies -->
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down Expand Up @@ -160,15 +152,7 @@
<version>6.0.53</version>
<scope>provided</scope>
</dependency>
<!-- Crypto Dependencies -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
</dependency>
<!-- Crypto Dependencies are pulled in via the `non-fips` (default) or `fips` profile -->
<!-- Testing Dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -483,11 +467,56 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{argLine} ${java.security.properties.test}</argLine>
</configuration>
</plugin>
</plugins>
</build>
<!--profile
to execute fuzz test -->
<profiles>
<profile>
<id>non-fips</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>fips</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<java.security.properties.test>-Djava.security.properties=${project.basedir}/src/test/resources/java.security.fips.test</java.security.properties.test>
</properties>
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bc-fips</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bctls-fips</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-fips</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Comment thread
mkleene marked this conversation as resolved.
</profile>
<!-- profile to execute fuzz test -->
<profile>
<id>fuzz</id>
<activation>
Expand Down
18 changes: 18 additions & 0 deletions sdk/src/main/java/io/opentdf/platform/sdk/AesGcm.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
Expand All @@ -20,10 +21,27 @@
public class AesGcm {
public static final int GCM_NONCE_LENGTH = 12; // in bytes
public static final int GCM_TAG_LENGTH = 16; // in bytes
public static final int GCM_KEY_SIZE_BITS = 256;
private static final String KEY_ALGORITHM = "AES";
private static final String CIPHER_TRANSFORM = "AES/GCM/NoPadding";

private final SecretKey key;

/**
* <p>Generate a fresh 256-bit AES key using the JCA {@link KeyGenerator}.</p>
*
* @return the encoded key bytes
*/
static byte[] generateKey() {
try {
KeyGenerator keyGenerator = KeyGenerator.getInstance(KEY_ALGORITHM);
keyGenerator.init(GCM_KEY_SIZE_BITS);
return keyGenerator.generateKey().getEncoded();
} catch (NoSuchAlgorithmException e) {
throw new SDKException("error generating AES key", e);
}
}


/**
* <p>Return symmetric key</p>
Expand Down
Loading
Loading