Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to integrate the Bouncy Castle provider in a Java program?

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());

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

What's the best choice?

like image 869
Pablosproject Avatar asked Jun 22 '11 14:06

Pablosproject


People also ask

Is bouncy castle part of Java?

BouncyCastle is a Java library that complements the default Java Cryptographic Extension (JCE).

What is bouncy castle provider?

Bouncy Castle is a Java library that complements the default Java Cryptographic Extension (JCE), and it provides more cipher suites and algorithms than the default JCE provided by Sun. In addition to that, Bouncy Castle has lots of utilities for reading arcane formats like PEM and ASN.

What is bouncy castle and example of?

Bouncy Castle is a collection of APIs used in cryptography. It includes APIs for both the Java and the C# programming languages. The APIs are supported by a registered Australian charitable organization: Legion of the Bouncy Castle Inc.


1 Answers

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.

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

like image 56
Robert Avatar answered Sep 28 '22 06:09

Robert