code: private static void generateKeyIfNotAvailable(String key, String salt) throws NoSuchAlgorithmException,
              UnsupportedEncodingException, InvalidKeySpecException {
          if (null == cryptKey) {
              LOG.debug("Generating Key...");
              SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
              char[] password = key.toCharArray();
              byte[] saltBytes = salt.getBytes(CoreConstants.ENCODE_UTF8);
  
              KeySpec spec = new PBEKeySpec(password, saltBytes, 65536, 128);
              SecretKey tmp = factory.generateSecret(spec);
              byte[] encoded = tmp.getEncoded();
              cryptKey = new SecretKeySpec(encoded, "AES");
          }
      }
docs: Generate key.
  
  @param key
  the key
  @param salt
  the salt
  @return the key
  @throws NoSuchAlgorithmException
  the no such algorithm exception
  @throws UnsupportedEncodingException
  the unsupported encoding exception
  @throws InvalidKeySpecException
  the invalid key spec exception