title: Export json encrypted with spring boot
body: <p>on my system 
  People's data should be exported to a Rest-based system via json, the post body payload should be encrypted ... as my knowledge are small with rest and springboot I have no idea if I'm doing it right .. ..I think not.
  * I'm using jooq</p>
  
  <p>Here I am looking for people and return a list of people</p>
  
  <pre><code>       Result&lt;Record&gt; result = ctx.select()
                  .from(PERSON)
                  .orderBy(PERSON.NUM)
                  .fetch();
  
          for (Record r : result) {
              Integer lNum = r.getValue(PERSON.NUM);
              String name = r.getValue(PERSON.SNOME);
              String rm = r.getValue(PERSON.SRM);
  
              personDto = new AlunoDto();
              personDto.setlNum(num);
              personDto.setsNome(name);
              personDto.setsRm(rm);
              personList.add(personDto);
          }
  
      } catch (Exception e) {
          e.printStackTrace();
      }
      **return personList;**
  </code></pre>
  
  <p>In my PersonController I get the list of people and step as parameter to the method that converts to json and encrypts</p>
  
  <pre><code>@RequestMapping(value = "/person", method = RequestMethod.GET)
  public String getAllPerson(){
      try {
         personsEncypted= convertToJson(personList);
      } catch (JsonProcessingException e) {
          e.printStackTrace();
      }
     return personsEncypted;
  }
  
     public String  convertToJson(List obj) throws JsonProcessingException {
  
      ObjectMapper mapper = new ObjectMapper();
      String onInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj);
  
      String key = "00000000000000000000000000"; 
      String personEncrypted= encrypt(key, jsonInString);
      return personEncrypted;
  }
  
  public static String encrypt(String key, String value) {
      try {
  
     SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
          cipher.init(Cipher.ENCRYPT_MODE,skeySpec);
          byte[] encrypted = cipher.doFinal(value.getBytes());
  
          return Base64.encodeBase64String(encrypted);
      } catch (Exception ex) {
          ex.printStackTrace();
      }
  
      return null;
  }
  </code></pre>
  
  <p>hitting the address in the browser is how the data appears
  <a href="https://i.stack.imgur.com/Er9He.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Er9He.png" alt="enter image description here"></a></p>
  
  <p>Will the other side consume the data? thank you so much...</p>