Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BouncyCastle openssl cannot be resolved

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

like image 591
whd Avatar asked Jun 11 '14 10:06

whd


People also ask

How do I update Bouncycastle?

To get the latest Bouncy Castle release, navigate to http://www.bouncycastle.org/latest_releases.html. Select the latest release, or the release that corresponds to your version of Java. Download the signed JAR file. Stop all the IBM processes and Lawson.

What is PEMParser in Java?

Class PEMParserClass for parsing OpenSSL PEM encoded streams containing X509 certificates, PKCS8 encoded keys and PKCS7 objects. In the case of PKCS7 objects the reader will return a CMS ContentInfo object.

Does bouncy castle Openssl?

openssl. openssl is not used by bouncycastle and bouncycastle is not used by openssl. They are completely independent. Android uses both.

What is Bouncycastle Bcprov?

The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 and up.


2 Answers

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>
like image 148
Stefano Sanfilippo Avatar answered Sep 20 '22 12:09

Stefano Sanfilippo


   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.

like image 44
programmer Avatar answered Sep 22 '22 12:09

programmer