I needed to implement RSA-2048 cryptography into the Android application I’m currently writing. After a lot of trial and error, I’ve finally came up with a working solution, which I’m going to share here.

The application is a messaging service, so everything here will be applied to strings.
I’m going to split the code and remove some parts to make it easier to read and explain.