AesCtrDrbg implements Drbg { void incrementReseedCounter(long increment) { if (increment < 0) { throw new IllegalArgumentException("Negative increment."); } if (reseedCounter + increment > RESEED_LIMIT) { throw new IllegalStateException( "Exceeded limit on generation requests. A DRBG with a fresh seed should be used."); } reseedCounter += increment; } AesCtrDrbg();  AesCtrDrbg(byte[] seed); @Override void nextBytes(byte[] bytes); static final int SEED_LENGTH; }
@Test(expected = IllegalStateException.class) public void testIncrementReseedCounterException() { AesCtrDrbg drbg = new AesCtrDrbg(new byte[32]); drbg.incrementReseedCounter((1L << 48) + 1); }
@Test(expected = IllegalArgumentException.class) public void testIncrementReseedNegativeIncrement() { AesCtrDrbg drbg = new AesCtrDrbg(new byte[32]); drbg.incrementReseedCounter(-1); }