code: public String signAndEncrypt(byte[] data) throws NoSuchAlgorithmException, NoSuchProviderException,
              NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException,
              SignatureException, InvalidAlgorithmParameterException, InvalidCipherTextException, IOException {
          String dataBase64 = Base64.toBase64String(data);
          String signBase64 = signDataWithBase64(data);
          JSONObject json = new JSONObject();
          json.put("data", dataBase64);
          json.put("signature", signBase64);
          String dataStr = json.toString();
          String cipher = encryptWithBase64(dataStr.getBytes());
          return cipher;
      }
docs: Sign and encrypt data then convert cipher to base64
  
  @param data
  data byte array to encrypt
  @return cipher in base64
  @throws NoSuchAlgorithmException
  NoSuchAlgorithmException
  @throws NoSuchProviderException
  NoSuchProviderException
  @throws NoSuchPaddingException
  NoSuchPaddingException
  @throws InvalidKeyException
  InvalidKeyException
  @throws IllegalBlockSizeException
  IllegalBlockSizeException
  @throws BadPaddingException
  BadPaddingException
  @throws SignatureException
  SignatureException
  @throws InvalidAlgorithmParameterException
  InvalidAlgorithmParameterException
  @throws IOException
  IOException
  @throws InvalidCipherTextException
  InvalidCipherTextException