2. For testing, the local encryption and decryption on the server are normal, and the encryption and decryption on Android are normal, but the password encrypted on the server (using the same public key) cannot be decrypted on Android (using the same private key).
3. Because I don't know the RSA encryption algorithm and the encryption process of Java RSA, I know that the length of padding characters in the encryption process may be different, which is related to the RSA algorithm specified during encryption and decryption.
4. For example, in the A machine, use standard RSA to encrypt with public key, and then use "RSA/ECB/NoPadding" to decrypt with private key in the B system. The result can be decrypted, but you will find that there are many special characters in front of the decrypted original, which are empty characters filled before encryption; If the standard RSA algorithm is still used to decrypt in the B system, it is of course exactly the same in the same type of JDK virtual machine environment. The key point is that the virtual machine (dalvik) used in android system is different from the JDK of SUN standard, and their default RSA implementation is also different.
More figuratively, when encrypting the original "abc", you directly use the bytes obtained from "abc". The getBytes () method may be only 3 in length, but the system first puts it in a byte array of 5 12 bits, new byte[5 12], and then encrypts it. But you used an "encrypted password" when you decrypted it. GetBytes () to decrypt it. The decrypted original text is naturally 5 12 long data, that is, other empty characters except "abc" are filled with more than 500 bytes.