Skip to content

Commit

Permalink
Refactor SecurityProcessor#addBouncyCastleExportsToNativeImage
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Jul 4, 2022
1 parent 12b4ee4 commit a849783
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,19 @@ public void write(String s, byte[] bytes) {
void addBouncyCastleExportsToNativeImage(BuildProducer<JPMSExportBuildItem> jpmsExports,
List<BouncyCastleProviderBuildItem> bouncyCastleProviders,
List<BouncyCastleJsseProviderBuildItem> bouncyCastleJsseProviders) {
boolean isInFipsMode;

Optional<BouncyCastleJsseProviderBuildItem> bouncyCastleJsseProvider = getOne(bouncyCastleJsseProviders);
if (bouncyCastleJsseProvider.isPresent() && bouncyCastleJsseProvider.get().isInFipsMode()) {
jpmsExports.produce(new JPMSExportBuildItem("java.base", "sun.security.internal.spec"));
jpmsExports.produce(new JPMSExportBuildItem("java.base", "sun.security.provider"));
if (bouncyCastleJsseProvider.isPresent()) {
isInFipsMode = bouncyCastleJsseProvider.get().isInFipsMode();
} else {
Optional<BouncyCastleProviderBuildItem> bouncyCastleProvider = getOne(bouncyCastleProviders);
if (bouncyCastleProvider.isPresent() && bouncyCastleProvider.get().isInFipsMode()) {
jpmsExports.produce(new JPMSExportBuildItem("java.base", "sun.security.internal.spec"));
jpmsExports.produce(new JPMSExportBuildItem("java.base", "sun.security.provider"));
}
isInFipsMode = bouncyCastleProvider.isPresent() && bouncyCastleProvider.get().isInFipsMode();
}

if (isInFipsMode) {
jpmsExports.produce(new JPMSExportBuildItem("java.base", "sun.security.internal.spec"));
jpmsExports.produce(new JPMSExportBuildItem("java.base", "sun.security.provider"));
}
}

Expand Down

0 comments on commit a849783

Please sign in to comment.