[Solved] Java.security.nosuchalgorithmexception: cannot find any provider supporting, mainmethod for AES encryption error

java.security.NoSuchAlgorithmException: Cannot find any provider supporting AES/CBC/PKCS7Padding
Solution:
Required jar packages.
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
<version>1.46</version>
</dependency>
Or directly download the jar at
https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk16/1.46/bcprov-jdk16-1.46.jar
1.Add the jar package bcprov-jdk16-1.46.jar to the jdk installation directory (%JAVA_HOME%\jre\lib\ext).
2. Modify the java.security file in the jdk installation directory (%JAVA_HOME%\jre\lib\security)
security.provider.7=com.sun.security.sasl.Provider Replace the following security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider

Similar Posts: