@Test
public void validateKey_checkAllLengths() throws Exception {

  ChaCha20Poly1305KeyManager manager = new ChaCha20Poly1305KeyManager();
  for (int i = 0; i < 100; i++) {
    if (i == 32) {
      manager.validateKey(createChaCha20Poly1305Key(i));
    } else {
      try {
        manager.validateKey(createChaCha20Poly1305Key(i));
        fail();
      } catch (GeneralSecurityException e) {
        // expected
      }
    }
  }
}