jdk1.4 How to use the RSA algorithm __ algorithm

Source: Internet
Author: User
Tags asymmetric encryption

Asymmetric encryption does not sound very appealing. Do you want to use the popular RSA algorithm to encrypt. First look at your JDK version, if it is jdk1.4, unfortunately, your JDK does not support this algorithm, you need to use bouncy Castle Crypto Package Third-party Package, this package can be http:// www.bouncycastle.org download, I downloaded is bcprov-jdk14-137.jar.

After downloading, you will also need to install the following steps:
1. Add the java.security file of the jre/lib/security subdirectory under the Java directory security.provider.<n>= Org.bouncycastle.jce.provider.BouncyCastleProvider, where <n> is incremented according to the ordinal number of the previous providers, for example, 6 in j2sdk1.4.2_13.
2. Copy the Bcprov-jdk14-137.jar to the Jre/lib/ext directory in the Java directory. (if not, copy to the Java directory under the Lib/ext directory, if not again, it will be copied to Ext's superior directory.) I can use it in the Jre/lib/ext directory. )

It is also important to note that, because of its low efficiency, this algorithm can be encrypted with a short plaintext length that takes the length of the key you generate. If your key length is 1024Bit (equivalent to 1024/8=128byte), then the encrypted plaintext length is 128-11=117byte, that is, in bytes, the number of bytes minus 11 with the key length, if not enough, you need to increase the key length, But that means lower efficiency, and the key length is limited between 512~2048.

Personal experience, for reference only:)

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.