Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

how do I use BouncyCastle libraries in my maven project?


Level 7

problem: My Java code cannot see BouncyCastle libraries.


situation: I have a component that needs to use BouncyCastle libraries. The other vendor has provided some Java examples on how to use their API and the examples uses BouncyCastle.I have tried using regular Java libraries (java.*) and it's not working. I'm just testing to see if the implementation requires BouncyCastle.


mvn integration with BouncyCastle:

To integrate BouncyCastle into my maven project, I changed core/pom.xml and added these lines




According to this, I need to use jdk18on for Java 8+. I'm on Java11.



1. When running an "mvn clean install", mvn fetches the BouncyCastle libraries. (I previously didn't have the bouncycastle folder prior to running the mvn command. Also mvn does not produce any compilation errors)


  my-work-desktop-mac in repository/org/bouncycastle 
  ➜  pwd
  my-work-desktop-mac in repository/org/bouncycastle 
  ➜  ls -al
  0755 - myuser 18 Apr 09:59 bcpkix-jdk18on
  0755 - myuser 18 Apr 09:59 bcprov-jdk18on
  0755 - myuser 18 Apr 09:59 bcutil-jdk18on
  my-work-desktop-mac in repository/org/bouncycastle 
  ➜  find . -iname "*.jar" -type f                                            



2. When I try to debug this code, my execution never stops at the 2nd or 3rd breakpoint after "stepping over" on the 1st breakpoint.


        try {
            String publicKeyAsString = "my-public-key-here";

            PEMParser pemParser = new PEMParser(new StringReader(publicKeyAsString)); //1st breakpoint

            String test=""; //2nd breakpoint

        } catch (Exception e) {
            System.out.println("error in here"); //3rd breakpoint



3. I'm using IntelliJ and IntelliJ often highlights possible issues/problems in my code. Right now, it's highlighting all the import statements I have for "org.bouncycastle" and  "PEMParser" line in no2.


3 Replies


Level 7

the page you linked mentions the 3rd party libraries are not resolving in system/console/bundles. but I'm not seeing it in my local AEM.

Also we've "imported" other 3rd party libraries like gson before and never encountered this problem.




Community Advisor


Have you checked bundle from osgi console? if it is active or not?

Also check the dependencyfinder from osgi to make sure dependencies are available in AEM