java.io.IOException: parseAlgParameters failed: PBE AlgorithmParameters not available, caused when docker container tries to access rabbitmq TLS port
I am trying to connect to a RabbitMQ instance through a TLS port from a docker container running a maven spring-boot application client.
Although I already update java.security with the line:
security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider
And I also added the jar of the Bouncy Castle inside the container and installing it through maven, and also adding the dependency to the parent pom of the project. An exception keeps on popping:
java.io.IOException: parseAlgParameters failed: PBE AlgorithmParameters not available
…
Caused by: java.security.NoSuchAlgorithmException: PBE AlgorithmParameters not available
Before running the Rabbitmq client through a container I ran it locally on a Ubuntu OS and it works fine. (https://www.rabbitmq.com/ssl.html , Example 2)
Docker container is a host enabled container that the .p12 and rabbitstore files are successfully delivered inside the container. The container uses jdk1.8 and successfully connects via the non-TLS port of rabbitmq.
The exception cause is appeared to be in this part of the code:
char[] keyPassphrase = "lerum".toCharArray();
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(new FileInputStream("test.p12"), keyPassphrase);
Is there anyone know what it could be off?
Dockerfile:
FROM maven:3.6.0-jdk-8 AS build
COPY /test.p12 /Cumulus/test.p12
COPY /certification.pem /Cumulus/certification.pem
COPY /jdk-8u241-linux-x64.tar.gz .
COPY /Scripts/install-java.sh .
COPY /jdk-8u241-linux-x64.tar.gz .
COPY /bcprov-ext-jdk15to18-167.jar /docker-java-home/jre/lib/ext/
COPY /java.security /docker-java-home/jre/lib/security/
#installing java
RUN yes | /install-java.sh -f /jdk-8u241-linux-x64.tar.gz
#environmental variables
RUN export JAVA_HOME=/docker-java-home/jre/lib/ext:$JAVA_HOME
#Bouncy Castle install
RUN mvn install:install-file -Dfile=bcprov-ext-jdk15to18-167.jar -DgroupId=org.bouncycastle -DartifactId=bcprov-jdk15on -Dversion=1.67 -Dpackaging=jar
RUN printf ‘lerumlerumnyes’ | keytool -import -alias server1 -file certification.pem -keystore rabbitstore
RUN mvn clean install
ENTRYPOINT ["/bin/bash","irrelevat.sh"]
Source: Docker Questions