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