public class MainActivity extends AppCompatActivity {
private static final String PUBLIC_KEY_BASE64_ENCODED = "INSERT HERE";
private final Gson gson = new Gson();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
PayLoadRequest request = new PayLoadRequest(
"first field",
"TeknoSeyir"
);
System.out.println("-------------------------------------------------------------------------------------------------------------");
System.out.println("JSON");
System.out.println(gson.toJson(request));
System.out.println("-------------------------------------------------------------------------------------------------------------");
byte[] base64EncryptedMessage = new RSAEncryption().encrypt(PUBLIC_KEY_BASE64_ENCODED.getBytes(), gson.toJson(request));
String base64EncryptedMessageString = new String(base64EncryptedMessage);
System.out.println("ENCRYPTED MESSAGE BASE64");
System.out.print(base64EncryptedMessageString);
System.out.println("/END ENCRYPTED MESSAGE BASE64");
} catch (Exception e) {
e.printStackTrace();
}