Reputation: 610
I'm trying to use the BCFIPS Provider in SpringBoot application. After running the SprintBoot executable war file it is throwing the following error. I couldn't find any info on this error if anyone has a any idea on this please help me.
@SpringBootApplication
public class TestApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
if (Security.getProvider("BCFIPS") == null) {
Security.insertProviderAt(new BouncyCastleFipsProvider(), 1);
}
SpringApplication.run(TestApplication.class, args);
}
}
Error:
Caused by: org.bouncycastle.crypto.fips.FipsOperationError: Module checksum failed: entry
at org.bouncycastle.crypto.fips.FipsStatus.checksumValidate(Unknown Source)
at org.bouncycastle.crypto.fips.FipsStatus.isReady(Unknown Source)
at org.bouncycastle.crypto.CryptoServicesRegistrar.getDefaultMode(Unknown Source)
at org.bouncycastle.crypto.CryptoServicesRegistrar.<clinit>(Unknown Source)
at org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider.<init>(Unknown Source)
at org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider.<init>(Unknown Source)
at org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider.<init>(Unknown Source)
Upvotes: 0
Views: 2434
Reputation: 11
You probably need to download the bc-fips.jar again and check the checksum.
Also, it doesn't work when you do that in the main method. (This is using Spring-Boot 1.5.11-RELEASE)
@SpringBootApplication
public class TestApplication {
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
@Bean
public Cipher cbcCipher() throws GeneralSecurityException {
Security.addProvider(new BouncyCastleFipsProvider());
return Cipher.getInstance("AES/CBC/PKCS7Padding", "BCFIPS");
}
}
Upvotes: 1