code: public static byte[] encrypt(byte[] contentByteArray, PublicKey publicKey) {
          try {
              Cipher cipher = Cipher.getInstance(algorithm);
              cipher.init(Cipher.ENCRYPT_MODE, publicKey);
              return cipher.doFinal(contentByteArray);
          } catch (NoSuchAlgorithmException e) {
              e.printStackTrace();
          } catch (NoSuchPaddingException e) {
              e.printStackTrace();
          } catch (InvalidKeyException e) {
              e.printStackTrace();
          } catch (BadPaddingException e) {
              e.printStackTrace();
          } catch (IllegalBlockSizeException e) {
              e.printStackTrace();
          }
          return null;
      }
docs: 使用公钥对内容进行加密
  
  @param contentByteArray
  @param publicKey
  @return