@Test
public void validateKeyFormat_notValid_throws() throws Exception {

  AesCmacKeyManager manager = new AesCmacKeyManager();
  try {
    manager.keyFactory().validateKeyFormat(makeAesCmacKeyFormat(32, 9));
    fail();
  } catch (GeneralSecurityException e) {
    // expected
  }
  try {
    manager.keyFactory().validateKeyFormat(makeAesCmacKeyFormat(32, 17));
    fail();
  } catch (GeneralSecurityException e) {
    // expected
  }
  try {
    manager.keyFactory().validateKeyFormat(makeAesCmacKeyFormat(32, 32));
    fail();
  } catch (GeneralSecurityException e) {
    // expected
  }
  try {
    manager.keyFactory().validateKeyFormat(makeAesCmacKeyFormat(16, 16));
    fail();
  } catch (GeneralSecurityException e) {
    // expected
  }
  try {
    manager.keyFactory().validateKeyFormat(makeAesCmacKeyFormat(64, 16));
    fail();
  } catch (GeneralSecurityException e) {
    // expected
  }
}