将Bouncy Castle提供程序集成到Java程序中的最佳方法是什么? [英] What's the best way to integrate the Bouncy Castle provider in a Java program?

查看:130
本文介绍了将Bouncy Castle提供程序集成到Java程序中的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Bouncy Castle提供程序集成到Java程序中的最佳方法是什么?
我知道我可以使用以下方式以编程方式添加它:

What's the best way to integrate the Bouncy Castle provider in a Java program? I know I can add it programmatically, by using:

import org.bouncycastle.jce.provider.BouncyCastleProvider;
...
Security.addProvider(new BouncyCastleProvider());

或者我可以将其添加到计算机上JRE的路径中。

Or either I can add it to a path in the JRE on my machine.

什么是最佳选择?

推荐答案

作为具有自己代码的安全提供程序,它是最佳选择。
这是因为它仅取决于项目,而不取决于系统。将BouncyCastle jar文件添加到您的项目中,然后将其添加到类路径中。它将在所有系统上运行,而无需进一步的手动安装步骤。

In my opinion the adding it as security provider with own code is the best option. This is because it is only project dependent - not system dependent. Add the BouncyCastle jar file(s) to your project and add them to the class-path and that's it. It will work on all systems without need for further manual installation steps.

如果将BouncyCastle安装到JRE中,则在必须更新JRE时总是会遇到问题。

If you install BouncyCastle into the JRE you always have problems in case you have to update the JRE.

这篇关于将Bouncy Castle提供程序集成到Java程序中的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆