private byte[] generateNonce(){
  byte[] nonce=new byte[32];
  SecureRandom secureRandom=new SecureRandom();
  secureRandom.nextBytes(nonce);
  return nonce;
}

private byte [ ] generateNonce ( ) { byte [ ] nonce = new byte [ 32 ] ; SecureRandom secureRandom = new SecureRandom ( ) ; secureRandom . nextBytes ( nonce ) ; return nonce ; }
for simplicity , we generate the nonce in the client . however , it should be generated on the server for anti - replay protection .
