AesCtrDrbg implements Drbg { void initCipher(byte[] key, byte[] iv) { SecretKeySpec keySpec = new SecretKeySpec(key, "AES"); IvParameterSpec ivSpec = new IvParameterSpec(iv); ExceptionConverter.safe(() -> { cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); return null; }, "Exception in initializing the cipher"); } AesCtrDrbg();  AesCtrDrbg(byte[] seed); @Override void nextBytes(byte[] bytes); static final int SEED_LENGTH; }
@Test public void testInitCipher() { Random rand = new Random(42); byte[] seed = new byte[32]; rand.nextBytes(seed); AesCtrDrbg drbg = new AesCtrDrbg(seed); drbg.initCipher(new byte[16], new byte[16]); }