Repository navigation
BouncyCastle Error integrating with Keycloak: java.lang.ClassNotFoundException: org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider #38959
Replies: 1 comment
|
The immediate problem is the value passed to Use one provider declaration: keytool -keystore /opt/keycloak/conf/server.keystore \
-storetype bcfks -providername BCFIPS \
-providerpath /opt/keycloak/providers/bc-fips-2.1.0.jar \
-providerclass org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider \
-alias localhost -genkeypair -sigalg SHA512withRSA -keyalg RSA \
-validity 730 -storepass '...' -keypass '...' -dname CN=localhostRemove the Also avoid registering BCFIPS as |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I am trying to integrate BouncyCastle library for our applications enabling FIPS compliance and trying to use it's Strong Algorithm of SecureRandom for DRBG keypair generation. Following the keycloak documentation over the same - https://www.keycloak.org/server/fips. We are correctly including the bc-fips-*.jar files into the keycloak provider via docker using this -
COPY --chown=1000 "files/*.jar" /opt/keycloak/providers/This is the keytool command I am using -
keytool -keystore /opt/keycloak/conf/server.keystore -storetype bcfks -providername BCFIPS -providerpath /opt/keycloak/providers/bc-fips-2.1.0.jar -providerclass /opt/keycloak/providers/org/bouncycastle/jcajce/provider/BouncyCastleFipsProvider.java -provider org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider -alias localhost -genkeypair -sigalg SHA512withRSA -keyalg RSA -validity 730 -storepass ******** -dname CN=localhost -keypass ********** -J-Djava.security.properties=/opt/keycloak/custom_configs/kc.java.security -J-Dorg.bouncycastle.fips.approved_only=true -J-Djava.security.debug=allbut it throws an error of -
And in the end it starts to take up -
sun.security.provider.NativePRNGwhich is not a FIPS approved RNG keypair algorithm.Which finally leads to this error -
org.bouncycastle.crypto.fips.FipsUnapprovedOperationError: Attempt to create key pair with unapproved RNG: ECOur java security file looks something like this -
Basically I think if we resolve this -
java.lang.ClassNotFoundException: org.bouncycastle.jcajce.provider.BouncyCastleFipsProviderthen it should start taking up DRBG, BCFIPS algo to create the FIPS approved keypairs.If anyone has worked around making your application FIPS compliant using BC or has an idea on this please let me know.
All reactions