Bouncycastle JCE Practice (II.) __JDK

Source: Internet
Author: User
Install Bouncycastle JCE

Install Bouncycastle JCE should follow the steps below:

1) Download Provider

As above, Bouncycastle can download from the www.bouncycastle.org, download it after the solution

Compression.

2 Copy the jar file to the appropriate location

If you want to make the JCE class available to 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 classes directory of the JDK, and then run the following command to package the files:

c:/> jar CVF Bouncycastle.jar javax org

In Windows, Java is typically installed in two directories. One directory for development, including all JDK tools, and the other is just a running environment. The JDK itself is typically located in a directory such as c:/jdk1.3, and the JDK runtime environment is typically located in directories such as C:/Program files/javasoft/jre1.3, which have an extended directory of libraries. respectively: C:/jdk1.3.1/lib/ext and C:/Program Files/javasoft/jre/1.3/lib/ext, put the desired jar file in the corresponding directory.

3) Configure the Security properties file

The security properties file Java.security is located under another directory/lib/security that is parallel to/lib/ext, which defines the cryptographic providers that are currently available. If you see the following statement:

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

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

It shows that this virtual machine has two cryptographic providers and their priorities and the names that are used when they are accessed. When a cryptographic algorithm is needed, the virtual opportunity accesses the providers listed here, searching for the desired algorithm, and using the first found algorithm in order of precedence here.

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

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

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

4 test the installation of a good program

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

The installation is successful, let us enter the fun world with Bouncycastle JCE to realize the security function!

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.