The standard name documentation of the Java Cryptography Architecture (JCE) contains a section about implementation requirements. For both Java 7 and Java 8 it contains the following entries for Cipher
with regards to RSA:
RSA/ECB/PKCS1Padding (1024, 2048)
RSA/ECB/OAEPWithSHA-1AndMGF1Padding (1024, 2048)
RSA/ECB/OAEPWithSHA-256AndMGF1Padding (1024, 2048)
to make sure you got the right one, specify the complete string (excluding the key sizes within the parenttheses of course). So that would be "RSA/ECB/OAEPWithSHA-1AndMGF1Padding"
for OAEP padding.
RSA is a set of internationally standardized algorithms (defined in the PKCS#1 standards and the RFC's derived from those standards). The implementations should confirm to the test vectors for any platform. RSA for instance uses big endian encoding, even on little endian platforms.
The Base64Encoder
is a Sun internal class. It may even be inconsistent across implementations and it may disappear without warning. It is used a lot unfortunately so Oracle and others may decide to leave it in place, just in case. You should never ever use Sun internal classes. Many static code validators and even IDE's will flag this as an error.
For Java 8 compatible runtimes you should use the Base64
class. For earlier versions you should go with a library. The Apache Commons Codec is often used. Google Guava is used a lot as well and has a set of codecs too.
Base 64 has been around for a long time. It should not run any differently on 32 bit or 64 bit on any platform, as long as you are sure you use the same character encoding. UTF-8 encoding - compatible with US ASCII for base 64 - should be preferred.
Finally there are the Java Bouncy Castle libraries and provider. The Bouncy Castle libraries contain an ever growing amount of cryptographic functionality that can be used on any Java runtime. The provider is used to allow much of this functionality to be used through the Java JCA/JCE. And it of course also contains a Base64
class in the "lightweight" API.
As long as you use the API correctly Java is fully compatible on 32 and 64 bit, big endian or little endian processors. It should not even matter if you use Linux, Windows, MacOS. Android should be compatible as well, although it is not an official Java distribution.