### Question:
JWTHelper { public static String createSignedJwt(String user, PrivateKey privateKey) throws Exception { Calendar c = Calendar.getInstance(); c.add(Calendar.MINUTE, 1); Date d = c.getTime(); return createSignedJwt(user, d.getTime() / 1000, privateKey); }  static String createSignedJwt(String user, PrivateKey privateKey); static String createSignedJwt(String user, long expiration, PrivateKey privateKey); static String createSignedJwtFromClaims(String constructedClaims, PrivateKey privateKey); static String decodeJwt(String in); static String JWT_HEADER; static String JWT_CLAIMS; }### Answer:
@Test public void testCreateJWT() throws Exception { long future = 1562389592; KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(4096, new SecureRandom(new byte[] { 1, 2, 4} )); KeyPair pair = keyGen.generateKeyPair(); PrivateKey priv = pair.getPrivate(); PublicKey pub = pair.getPublic(); System.out.println("Private Key"); System.out.println(Base64.getEncoder().encodeToString(priv.getEncoded())); System.out.println("Public Key"); System.out.println(Base64.getEncoder().encodeToString(pub.getEncoded())); String jwt = JWTHelper.createSignedJwt(NAME, future, priv); System.out.println("actual:"); output(jwt); String[] parts = jwt.split("\\."); verifySignature(pub, parts); Assert.assertEquals(EXPECTED_PART1, parts[0]); Assert.assertEquals(EXPECTED_PART2, parts[1]); }