End of basic RSA implementation