EncryptionUtil { public static byte[] generateVerifyToken(Random random) { byte[] token = new byte[VERIFY_TOKEN_LENGTH]; random.nextBytes(token); return token; } private  EncryptionUtil(); static KeyPair generateKeyPair(); static byte[] generateVerifyToken(Random random); static String getServerIdHashString(String sessionId, SecretKey sharedSecret, PublicKey publicKey); static SecretKey decryptSharedKey(PrivateKey privateKey, byte[] sharedKey); static byte[] decrypt(PrivateKey key, byte[] data); static final int VERIFY_TOKEN_LENGTH; static final String KEY_PAIR_ALGORITHM; }
@Test public void testVerifyToken() throws Exception { SecureRandom random = new SecureRandom(); byte[] token = EncryptionUtil.generateVerifyToken(random); assertThat(token, notNullValue()); assertThat(token.length, is(4)); }