@Test public void testInvalidKeyMaterial() throws Exception { Key valid = TestUtil.createKey( TestUtil.createHmacKeyData(Random.randBytes(HMAC_KEY_SIZE), 16), 42, KeyStatusType.ENABLED, OutputPrefixType.TINK); Key invalid = TestUtil.createKey( TestUtil.createAesSivKeyData(64), 43, KeyStatusType.ENABLED, OutputPrefixType.TINK); KeysetHandle keysetHandle = TestUtil.createKeysetHandle(TestUtil.createKeyset(valid, invalid)); try { MacFactory.getPrimitive(keysetHandle); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertExceptionContains(e, "com.google.crypto.tink.Mac not supported"); } keysetHandle = TestUtil.createKeysetHandle(TestUtil.createKeyset(invalid, valid)); try { MacFactory.getPrimitive(keysetHandle); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertExceptionContains(e, "com.google.crypto.tink.Mac not supported"); } }
@Deprecated public static Mac getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }
MacFactory { @Deprecated public static Mac getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); } }
MacFactory { @Deprecated public static Mac getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  }
MacFactory { @Deprecated public static Mac getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  @Deprecated static Mac getPrimitive(KeysetHandle keysetHandle); @Deprecated static Mac getPrimitive(KeysetHandle keysetHandle, final KeyManager<Mac> keyManager); }
MacFactory { @Deprecated public static Mac getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  @Deprecated static Mac getPrimitive(KeysetHandle keysetHandle); @Deprecated static Mac getPrimitive(KeysetHandle keysetHandle, final KeyManager<Mac> keyManager);  }