title: convert String publickey to RSA publickey
body: <p>I'm trying to convert string public key to publickey with modulus and exponent.
  but how come it doesnt works?</p>
  
  <p>this is my code</p>
  
  <pre><code>     public void toPubKey(String filename,String sms) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException, IOException{
      byte[]keyBytes=sms.getBytes();
      byte[]decode = Base64.encode(keyBytes, Base64.DEFAULT);
      KeyFactory fact = KeyFactory.getInstance("RSA");
      X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(decode);
      PublicKey pubKey2 = (PublicKey)fact.generatePublic(x509KeySpec);
      saveToFile(filename,pubKey2);
  </code></pre>
  
  <p>any problem with my code?</p>