Front-end js encryption related to RSA encryption and decryption, and server-side java decryption

Source: Internet
Author: User

I have been studying RSA recently. I will share some important points after the demo runs.

1, js encryption function, you can write can also download open source, such as dave@ohdave.com/rsa, download them directly use it.

2. Understand the meaning of parameters RSAKeyPair (encryptionExponent, decryptionExponent, modulus). The first is the encryption index, the second is the decryption index, and the third is the coefficient, to understand these three parameters, you need to read the specific implementation of the RSA algorithm. Here we will not talk about it much, but go to Wikipedia to see it.

3. After reading the second article, you will know that the encryption index and coefficient should be obtained from the server. This can be obtained directly from the key, RSAPublicKey. getXXX () is enough. Another thing to note is that data is transmitted in hexadecimal strings. You must note the conversion function. You can write or use the ready-made conversion function, personal hobbies

4. When using Cipher. getInstance (ALGORITHOM, DEFAULT_PROVIDER), pay attention to using the jar of an RSA encryption provider,

Import org. bouncycastle. jce. provider. BouncyCastleProvider;

Private static final Provider DEFAULT_PROVIDER = new BouncyCastleProvider...

Oh, my personal sorting is mainly to pay attention to the above four points, so that the preliminary demo can be implemented, and it will be easier to do SSL and certificates in the future .... The sharing ended due to time issues. If you have any questions, please leave a message.

 

This article is from the BloYu blog, please be sure to keep this source http://johnchina.blog.51cto.com/4390273/1017894

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.