Bouncycastle JCE Practice (2)

xiaoxiao2021-03-17  183

Install Bouncecastle JCE

Installing Bouncecastle JCE should follow these steps:

1) Download the provider

As above, BounceCastle can download it from www.bouncecastle.org, then solve it after downloading

compression.

2) Copy the JAR file to the appropriate position

If you want the JCE class to be used by all Java applications, we need to install the JAR file as an extension. The Bouncecastle provider is not used to install the JAR file that is expanded, but it is easy to build. First expand the downloaded file to the Classes directory of JDK, then run the following command to package these files:

C: /> JAR CVF Bouncecastle.jar Javax ORG

In Windows, Java is usually installed in two directories. A directory is used to develop, including all JDK tools, and another is just a running environment. JDK itself is usually located in the directory of C: /JDK1.3, while the JDK runtime environment is usually located in the directory of C: / Program Files / JavaSoft / JRE1.3, and they all have library expansion directories. They are: c: /jdk1.3.1/lib/ext and c: / program files / javasoft / jre / 1.3 / lib / ext, put the JAR file to the corresponding directory.

3) Configure security properties files

Security Properties Files Java.Security Located in another directory / lib / security in parallel / lib / ext, it defines the encryption provider currently available. As you can see the following statement:

Security.Provider.1 = sun.security.provider.sun

Security.Provider.2 = com.sun.rsajca.provider

It indicates that this virtual machine has two encrypted providers and the names used when they prioritize and access. When you need to use an encryption algorithm, the virtual opportunity sequentially accesses the providers listed here, find the desired algorithm, and use the first found algorithm in the priority order here.

We should insert as downtown in the file, join the new providers into:

Security.Provider.3 = Org.bouncecastle.jce.Provider.bouncecastleProvider

Of course, you can also delete the previous encryption provider, so you can't use the JDK default encryption provider.

4) Test the installed program

We can write a test program (using the API of the JCE package) to determine whether our installation is successful.

Successful installation, let us enter interesting world with BounceCastle JCE to achieve security features!

转载请注明原文地址:https://www.9cbs.com/read-129623.html

New Post(0)