-
Notifications
You must be signed in to change notification settings - Fork 3
fix: verify that bc works with approved_only mode set
#375
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
Open
mkleene
wants to merge
50
commits into
main
Choose a base branch
from
enhance-fips-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
9bf8ebc
set bc in approved only
mkleene 47d455c
feat(sdk): use cipher wrap/unwrap for RSA key operations
mkleene ff37ca6
add an empty default key store in FIPS mode
mkleene 335cfd4
add new module
mkleene 25d4b2a
use a good envvar
mkleene debc0cf
deal with the CP correctly
mkleene 9d75430
do this faster
mkleene 49aae55
set this up
mkleene 0d79a1f
include the main class
mkleene 057d260
get the property right
mkleene f272301
one more segment
mkleene 1c80757
print stuff out
mkleene f00598d
see if this works
mkleene 7e08117
oops
mkleene 6a137c4
one more
mkleene af427fc
one more
mkleene e4b4aa1
try this
mkleene 81afe20
move this back to the right place
mkleene d03af4b
one more
mkleene 2014c3d
make sure to get output it
mkleene 2629f07
debug
mkleene 2309106
maybe this
mkleene f24d41a
see about this
mkleene c999916
crazy
mkleene 027ab7d
one more try
mkleene fad0435
one more
mkleene 8f1fd51
more logging
mkleene 36b7141
ok
mkleene 6669843
more logging
mkleene da712ee
more logging
mkleene 815be2a
one more
mkleene 3511f02
one more log
mkleene fa5c26f
try changing the log level
mkleene f3c811b
more explicit logging
mkleene 6dd35f2
get some logs
mkleene 32d7d42
yikes
mkleene d24c1a9
one more
mkleene 54752b9
just run it in FIPS mode all the time
mkleene b5e820f
sonarcloud
mkleene 5b07fa8
fix mvnverify
mkleene 887ba9d
refer to the module in a simpler way
mkleene d7621b7
refactor scripts some
mkleene 2a8bd54
update permissions
mkleene 9369d07
Update TDFReader.java
mkleene 46d1d87
Remove static logger from TDFReader
mkleene baee611
Update log4j2.xml
mkleene 9d21147
Update TDF.java
mkleene a8c39b4
Remove blank lines in TDF.java
mkleene 517bd27
fix label
mkleene 4683cc5
Merge remote-tracking branch 'origin/enhance-fips-tests' into enhance…
mkleene File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
sdk/src/test/java/io/opentdf/platform/sdk/FipsProviderVerificationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package io.opentdf.platform.sdk; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.condition.EnabledIfSystemProperty; | ||
|
|
||
| import java.security.Security; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.*; | ||
|
|
||
| /** | ||
| * Verifies that the java.security.fips.test properties file was actually loaded when running | ||
| * under the fips Maven profile. Without this check, a misconfigured argLine would silently run | ||
| * all other tests against the default (non-FIPS) provider stack. | ||
| */ | ||
| @EnabledIfSystemProperty(named = "org.bouncycastle.fips.approved_only", matches = "true") | ||
| class FipsProviderVerificationTest { | ||
|
|
||
| @Test | ||
| void bcFipsIsFirstProvider() { | ||
| var providers = Security.getProviders(); | ||
| assertNotNull(providers, "No security providers registered"); | ||
| assertTrue(providers.length > 0, "Provider list is empty"); | ||
| assertEquals("BCFIPS", providers[0].getName(), | ||
| "Expected BCFIPS as the first security provider but got: " + providers[0].getName() | ||
| + " — the java.security.fips.test file was likely not loaded"); | ||
| } | ||
|
|
||
| @Test | ||
| void bcJsseIsRegistered() { | ||
| assertNotNull(Security.getProvider("BCJSSE"), | ||
| "BCJSSE provider is not registered — the java.security.fips.test file was likely not loaded"); | ||
| } | ||
|
|
||
| @Test | ||
| void sunJceIsNotRegistered() { | ||
| assertNull(Security.getProvider("SunJCE"), | ||
| "SunJCE provider is still registered — it should have been removed by java.security.fips.test"); | ||
| } | ||
|
|
||
| @Test | ||
| void keyManagerFactoryAlgorithmIsPkix() { | ||
| assertEquals("PKIX", Security.getProperty("ssl.KeyManagerFactory.algorithm"), | ||
| "ssl.KeyManagerFactory.algorithm was not overridden to PKIX — the java.security.fips.test file was likely not loaded"); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.