-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure FIPS-mode can be enabled by fixing existent and creating addit…
…ional tests. Signed-off-by: Iwan Igonin <[email protected]>
- Loading branch information
Showing
89 changed files
with
1,404 additions
and
642 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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
36 changes: 36 additions & 0 deletions
36
client/rest/src/main/java/org/opensearch/client/FipsEnabledThreadFactory.java
This file contains 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,36 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.client; | ||
|
||
import org.apache.hc.core5.concurrent.DefaultThreadFactory; | ||
import org.bouncycastle.crypto.CryptoServicesRegistrar; | ||
|
||
import java.util.concurrent.ThreadFactory; | ||
|
||
public class FipsEnabledThreadFactory implements ThreadFactory { | ||
|
||
private final ThreadFactory defaultFactory; | ||
private final boolean isFipsEnabled; | ||
|
||
public FipsEnabledThreadFactory(String namePrefix, boolean isFipsEnabled) { | ||
this.defaultFactory = new DefaultThreadFactory(namePrefix); | ||
this.isFipsEnabled = isFipsEnabled; | ||
} | ||
|
||
@Override | ||
public Thread newThread(final Runnable target) { | ||
return defaultFactory.newThread(() -> { | ||
if (isFipsEnabled) { | ||
CryptoServicesRegistrar.setApprovedOnlyMode(true); | ||
} | ||
target.run(); | ||
}); | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.