Code example for RSAPrivateKeySpec

				ModExpResult pub = LoadKey(b64_pubkey);
	        	ModExpResult prv = LoadKey(b64_prvkey);
				KeyFactory fact = KeyFactory.getInstance(ALGORITHM);
				PublicKey 	pubkey = fact.generatePublic(new RSAPublicKeySpec(pub.Modulus, pub.Exponent));
				PrivateKey 	prvkey = fact.generatePrivate(new RSAPrivateKeySpec(prv.Modulus, prv.Exponent));
				return new KeyPair(pubkey, prvkey);
	        } catch (Exception ex) {
	            Log.e(TAG, "Error while loading rsa keypair", ex);
			return null;	 
		private ModExpResult LoadKey(String b64_key) throws Exception {
			byte[] byte_pubkey = Base64.decode(b64_key, Base64.DEFAULT);
	        ByteArrayInputStream bi = new ByteArrayInputStream(byte_pubkey);
        	ObjectInputStream oi = new ObjectInputStream(bi);
        	BigInteger mod = (BigInteger)oi.readObject();
Connect your IDE to all the code out there  Get Codota for Java