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:)