10

I wanted to code from this answer but i have error The import org.bouncycastle.openssl cannot be resolved The import org.bouncycastle.openssl cannot be resolved and i have no idea how coudl i repair this becouse other bouncycastle libs are detected correctly. I will be grateful for any ideas whats wrong. Im using eclipse and i have instaled bouncycastle like in this instruction itcsoultions

Community
  • 1
  • 1
whd
  • 1,819
  • 1
  • 21
  • 52
  • How are you building your program? Maven? ANT? Raw command line? If so, please show us your build script. Also, what BC components have you installed? – Stefano Sanfilippo Jun 11 '14 at 10:57

2 Answers2

28

In addition to the provider (a.k.a. bcprov) and lightweight API, you also need the PKIX API, which provides the openssl package.

Either download bcpkix-jdk15on-150.jar from BC downloads page (direct link) and drop it in the same directory of bcprov or add it to your maven dependencies with its coordinates:

<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcpkix-jdk15on</artifactId>
    <version>1.50</version>
</dependency>
Stefano Sanfilippo
  • 32,265
  • 7
  • 79
  • 80
4

   Whenever we get error saying "The import *** cannot be resolved", it means that there is problem with library. Here, bcprov-jdk jar is missing. I did the following, and it worked for me!

    1. Download bcprov-jdk15on-152.jar from https://www.bouncycastle.org/latest_releases.html
    2. Right click on Project-->Properties-->Java Build Path-->Libraries tab--> Click on Add         External JARs.. Select the path where you have the dowlnloaded bcprov-jdk15on-152.jar.
        Then click OK. That's it.

programmer
  • 472
  • 4
  • 5