Here you can find the source of getPublicKey(BigInteger modulus, BigInteger exponent)
public static RSAPublicKey getPublicKey(BigInteger modulus, BigInteger exponent) throws NoSuchAlgorithmException, InvalidKeySpecException
//package com.java2s; //License from project: Apache License import java.math.BigInteger; import java.security.*; import java.security.interfaces.RSAPublicKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.RSAPublicKeySpec; public class Main { public static RSAPublicKey getPublicKey(BigInteger modulus, BigInteger exponent) throws NoSuchAlgorithmException, InvalidKeySpecException { KeyFactory keyFactory = KeyFactory.getInstance("RSA"); RSAPublicKeySpec keySpec = new RSAPublicKeySpec(modulus, exponent); return (RSAPublicKey) keyFactory.generatePublic(keySpec); }/*from w w w .j ava 2s . co m*/ }