code: public static String publicKeyEncrypt(String key, String plainText) throws NoSuchAlgorithmException,
              InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, BadPaddingException,
              IllegalBlockSizeException, UnsupportedEncodingException {
          PublicKey publicKey = commonGetPublickeyByText(key);
          Cipher cipher = Cipher.getInstance(RSA);
          cipher.init(Cipher.ENCRYPT_MODE, publicKey);
  
          byte [] result = cipher.doFinal(plainText.getBytes(Charset.UTF_8));
  
          return Base64.byteArrayToBase64(result);
      }
docs: 公钥加密
  @param key [ellipsis]
  @param plainText [ellipsis]
  @return [ellipsis]
  @throws NoSuchAlgorithmException [ellipsis]
  @throws InvalidKeySpecException [ellipsis]
  @throws NoSuchPaddingException [ellipsis]
  @throws InvalidKeyException [ellipsis]
  @throws BadPaddingException [ellipsis]
  @throws IllegalBlockSizeException [ellipsis]
  @throws UnsupportedEncodingException [ellipsis]