Java BouncyCastle openssl 无法解析

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24161146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 10:33:47  来源:igfitidea点击:

BouncyCastle openssl cannot be resolved

javabouncycastle

提问by whd

I wanted to code from this answerbut i have error The import org.bouncycastle.openssl cannot be resolvedThe import org.bouncycastle.openssl cannot be resolvedand 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

我想从这个答案中编码, 但我有错误The import org.bouncycastle.openssl cannot be resolvedThe import org.bouncycastle.openssl cannot be resolved,我不知道我如何修复它,因为其他 bouncycastle 库被正确检测到。我将不胜感激任何想法出了什么问题。我使用 Eclipse 并且我已经安装了bouncycastle就像在这个指令中一样itcsoultions

采纳答案by Stefano Sanfilippo

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

除了提供程序(又名bcprov)和轻量级 API,您还需要 PKIX API,它提供了openssl包。

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

无论是下载bcpkix-jdk15on-150.jar公元前下载页面直接链接),并把它在同一个目录bcprov或它与它的坐标添加到您的Maven依赖关系:

<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcpkix-jdk15on</artifactId>
    <version>1.50</version>
</dependency>

回答by programmer

   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.

   每当我们收到错误消息“无法解决导入 ***”时,就意味着库存在问题。在这里,缺少 bcprov-jdk jar。我做了以下事情,它对我有用!

    1. 从https://www.bouncycastle.org/latest_releases.html下载 bcprov-jdk15on-152.jar
    2. 右键单击Project-->Properties-->Java Build Path-->Libraries 选项卡--> 点击添加外部 JAR。选择下载 bcprov-jdk15on-152.jar 的路径。
        然后单击确定。就是这样。