title: with a rsa publickey string (not a file), when I encrypt, I got an error "invalid key format"
body: <p>I've a public key string(get from an api), and i want to encrypt the parameter using the public key, while I get the error "java.security.InvalidKeyException: invalid key format", my code is as below:</p>
  
  <pre><code>try {
              KeyFactory keyFactory = KeyFactory.getInstance("RSA");
              X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(publicKey.getBytes());
              PublicKey key = keyFactory.generatePublic(publicKeySpec);
              params = EncryptionUtil.encrypt(params.getBytes(), key);
          } catch (Exception e) {
              logger.error(e.getMessage());
          }
  
          logger.info("encrypt params:" + params);
  </code></pre>
  
  <p>the publicKey value is: "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBYu61cljDpI+XdWPO1bi5Ricv5+U/4u9Mqj4SdWp8YnCr3FaXTphW5mJol9KdqzK50GmD0Kv1x4z5gz6TDayfn527FX9KEO/puFlPiIkik2lg5UP9vGIyeWKoaxw1S8skjW13Md+Lw4i9ZqeoI9boLVMJdxMCtS+MTVDNxwDShwIDAQAB"</p>
  
  <p>so, how to solve the problem?</p>