AesCtrDrbg implements Drbg { void nextBytesBounded(byte[] zeroes, byte[] output) { if (generatedBytes + output.length > UPDATE_LIMIT) { update(); } try { this.cipher.update(zeroes, 0, zeroes.length, output); } catch (ShortBufferException e) { throw new IllegalArgumentException("Exception generating bits", e); } generatedBytes += output.length; } AesCtrDrbg();  AesCtrDrbg(byte[] seed); @Override void nextBytes(byte[] bytes); static final int SEED_LENGTH; }
@Test(expected = IllegalArgumentException.class) public void testNextBytesBounded() { AesCtrDrbg drbg = new AesCtrDrbg(new byte[32]); drbg.nextBytesBounded(new byte[20], new byte[10]); }