I am trying to use bc-fips-1.0.1 for a small java application but I am consistently met with the following warning when I run the program:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider$CoreSecureRandom (file:/home/****/IdeaProjects/java-projects/test-project/lib/bc-fips-1.0.1.jar) to method sun.security.jca.Providers.getSunProvider()
WARNING: Please consider reporting this to the maintainers of org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider$CoreSecureRandom
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Having added the correct entry for the library into the "java.security" file and added the jar file as a global library in Intellij I am getting the warning from the key initalization line in the following code:
public static void main(String[] args){
try{
KeyPairGenerator kp = KeyPairGenerator.getInstance("RSA", "BCFIPS");
kp.initialize(2048);
}catch(GeneralSecurityException e){
System.out.println(e.getMessage());
}
}
I have tried using the bcfips recommended key initialization syntax:
keyPairGenerator.initialize(new RSAKeyGenParameterSpec(3072, RSAKeyGenParameterSpec.F4));
I have also tried switching my JDK from 11.0.2 to 11.0.5. Researching reflection gave me no further insight into what the issue could be. I have also tried adding the provider dynamically but this does not change the warning.