IllegalBlockSize Exception When Doing RSA on bytes of Strings
问题 I am trying to write RSA encryption and decryption classes in Java for a server where the client will be passing strings back and forth. I have the following code for the classes: public class RSAEncryption { public static final String KEYGENALGORITHM = "RSA"; public static final String ALGORITHM = "RSA/ECB/PKCS1Padding"; public static KeyPairContainer generateKey() { KeyPairGenerator keyGen; KeyPair key; try { keyGen = KeyPairGenerator.getInstance(KEYGENALGORITHM); keyGen.initialize(1024);