@Test public void testSmallPlaintextWithRawKey() throws Exception { byte[] keyValue = Random.randBytes(HMAC_KEY_SIZE); Key primary = TestUtil.createKey( TestUtil.createHmacKeyData(keyValue, 16), 42, KeyStatusType.ENABLED, OutputPrefixType.RAW); KeysetHandle keysetHandle = TestUtil.createKeysetHandle( TestUtil.createKeyset(primary)); Mac mac = MacFactory.getPrimitive(keysetHandle); byte[] plaintext = "blah".getBytes("UTF-8"); byte[] tag = mac.computeMac(plaintext); assertEquals(16 , tag.length); try { mac.verifyMac(tag, plaintext); } catch (GeneralSecurityException e) { fail("Valid MAC, should not throw exception"); } }
@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);  }