I am trying to encode a simple String \"test\" back and forth.
public static String encode(Key publicKey, String data) throws NoSuchAlgorithmException, NoSuchPad
From here:
The RSA algorithm can only encrypt data that has a maximum byte length of the RSA key length in bits divided with eight minus eleven padding bytes, i.e. number of maximum bytes = key length in bits / 8 - 11. If you want to encrypt larger data, then use a larger key, for example, a key with 4096 bits will allow you to encrypt 501 bytes of data.