Bouncycastle JCE practice (2)

Source: Internet
Author: User
?

Install bouncycastle JCE

To install bouncycastle JCE, follow these steps:

1) download provider

As shown above, bouncycastle can be downloaded from www.bouncycastle.org.

Compression.

2) copy the JAR file to the appropriate location

To enable the JCE class to be used by all Java applications, we need to install the JAR file as an extension. The bouncycastle provider does not have a jar file for installation as an extension, but it is easy to build. First, expand the downloaded files to the JDK classes directory, and then run the following command to package these files:

C:/> jar CVF bouncycastle. Jar javax org

In Windows, Java is usually installed in two directories. One directory is used for development, including all JDK tools, and the other is the runtime environment. JDK itself is usually located in a directory such as C:/jdk1.3, while the JDK runtime environment is usually located in a directory such as C:/program files/program oft/jre1.3, they all have Library Extension directories. C:/jdk1.3.1/lib/EXT and C:/program files/javasoft/JRE/1.3/lib/EXT, respectively. The jar files are stored in the corresponding directory.

3) configure the Security Attribute File

The Security Attribute file java. Security is located in another directory parallel to/lib/EXT/lib/security, which defines the currently available encryption providers. See the following statement:

Security. provider.1 = sun. Security. provider. Sun

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

It indicates that the virtual machine has two encryption providers and their priority and the name used for access. When an encryption algorithm is required, the virtual opportunity will access the providers listed here in turn, find the desired algorithm, and use the first algorithm in the order of priority.

We should insert the following lines in the file to add the new provider:

Security. provider.3 = org. bouncycastle. JCE. provider. bouncycastleprovider

Of course, you can also delete the previous encryption provider configuration so that you cannot use the JDK default encryption provider.

4) Test the installed program

We can write a Test Program (using the JCE package API) to determine whether the installation is successful.

The installation is successful. Let's go to the interesting world of using bouncycastle JCE to implement security functions!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.