Commit 63b49af
feat(sdk)!: remove bouncycastle and ayza libraries (#367)
This pull makes this library provider-agnostic. Users can control how
cryptography is provided by configuring
their `java.security` configuration, as we do in the FIPS-profile tests.
We add two new maven profiles `fips` and
`non-fips`. These profiles are used solely for testing; the library
itself is agnostic to which providers are used
for cryptography.
In the `non-fips` profile we use the normal providers configured on the
JVM. The BouncyCastle provider is included
just for some test verification.
In the `fips` profile we include the BouncyCastle FIPS providers we need
at runtime to verify that our library works with a FIPS-compliant setup.
## Ayza removal
I believe it's necessary to remove ayza since it loads a
BouncyCastleProvider explicitly. Since the FIPS provider
occupies the same namespace loading both providers can't work.
## BouncyCastle moved to test-only
Removing BouncyCastle as a compile dependency isn't strictly necessary
but it results in much less rework and
eliminates a transitive dependency for consumers.
## Remaining FIPS work
We still need to:
* verify that the JWK libraries we use are FIPS compliant with the
correct providers to claim that this
library can be made FIPS compliant
* verify that we generate random numbers in a FIPS-compliant way.
Because BouncyCastle does not provide a
FIPS-compliant source of entropy we need to include the SUN provider to
get at `/dev/rand`. This is OK, since
* we _should_ pick up this provider and use it for all cryptographic
operations (but we may want to provide ways to guarantee that a
particular provider is used)
* the FIPS boundary for random numbers starts at the provider. We don't
have tools to verify this now, though
The breaking API changes are as follows:
| Area | Change | Related to |
|---|---|---|
| `SDKBuilder.sslFactory(SSLFactory)` | **Removed.** Replaced by
`sslFactory(SSLSocketFactory)` and `sslFactory(SSLSocketFactory,
X509TrustManager)` | Ayza removal |
| `SDKBuilder.sslFactoryFromTrustManager(X509TrustManager)` | **New**
method | Ayza removal |
| `ECKeyPair(ECCurve, ECAlgorithm)` constructor | **Removed.** Replaced
by `ECKeyPair(ECCurve)` | BouncyCastle removal |
| `ECKeyPair.publicKeyFromPem` | Removed method from public interface
since it should not have been exposed and since the types were changing
anyway | BouncyCastle removal |
| `ECKeyPair.privateKeyFromPem`, `getPEMPublicKeyFromX509Cert`,
`publicKeyFromECPoint`, static `compressECPublickey(String)` |
**Removed** from public API (moved to test-only `PemTestUtils`) |
BouncyCastle removal |
| Dependencies | Drops `io.github.hakky54:ayza*` and the runtime BC dep;
adds `bc-fips`, `bcpkix-fips`, `bctls-fips` (via new `fips`/`non-fips`
Maven profiles) | Both |
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* FIPS-profile cryptography support and improved TLS trust-material
builder (directory/keystore/trust-manager sources).
* **Improvements**
* Migrated crypto to standard Java security APIs for broader
compatibility.
* Added AES-GCM key-generation helper and more robust TLS/trust-manager
integration across the SDK.
* **Tests**
* Updated and added tests and test utilities for PEM/EC key handling and
TLS/trust behaviors.
* **Chores**
* Updated build/test config and pinned Bouncy Castle FIPS dependencies.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/opentdf/java-sdk/pull/367?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>1 parent 9991b07 commit 63b49af
18 files changed
Lines changed: 984 additions & 369 deletions
File tree
- .github/workflows
- adr/0001
- cmdline/src/main/java/io/opentdf/platform
- sdk
- src
- main/java/io/opentdf/platform/sdk
- test
- java/io/opentdf/platform/sdk
- resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | | - | |
91 | 90 | | |
92 | 91 | | |
93 | 92 | | |
94 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
95 | 105 | | |
96 | 106 | | |
97 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
262 | 263 | | |
263 | 264 | | |
264 | 265 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
| 266 | + | |
269 | 267 | | |
270 | 268 | | |
271 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | 83 | | |
115 | 84 | | |
116 | 85 | | |
| |||
157 | 126 | | |
158 | 127 | | |
159 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
160 | 149 | | |
161 | 150 | | |
162 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 38 | | |
47 | 39 | | |
48 | 40 | | |
| |||
160 | 152 | | |
161 | 153 | | |
162 | 154 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 155 | + | |
172 | 156 | | |
173 | 157 | | |
174 | 158 | | |
| |||
483 | 467 | | |
484 | 468 | | |
485 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
486 | 477 | | |
487 | 478 | | |
488 | | - | |
489 | | - | |
490 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
491 | 520 | | |
492 | 521 | | |
493 | 522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
27 | 45 | | |
28 | 46 | | |
29 | 47 | | |
| |||
0 commit comments