TokenEncryptor { public String generate() throws NoSuchAlgorithmException { KeyGenerator generator = KeyGenerator.getInstance(ALGORITHM); generator.init(128); SecretKey sk = generator.generateKey(); return Base64.encodeBase64String(sk.getEncoded()); } TokenEncryptor(String secretKey); String generate(); String encrypt(Token token); Token decrypt(String encryptedToken);  }
@Test public void testGenerate() throws NoSuchAlgorithmException { String res = tokenEncryptor.generate(); System.out.println("res=" + res); }