test_class.declarator: HMAC_KEY_SIZE = 20
test_class.modifier: private static final
test_class.original_string: private static final int HMAC_KEY_SIZE = 20;
test_class.type: int
test_class.var_name: HMAC_KEY_SIZE
test_class.file: java_src/src/test/java/com/google/crypto/tink/mac/MacFactoryTest.java
test_class.identifier: MacFactoryTest
test_case.body: @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");
      }
  
      // invalid as the primary key.
      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");
      }
    }
test_case.class_method_signature: MacFactoryTest.testInvalidKeyMaterial()
test_case.full_signature: @Test public void testInvalidKeyMaterial()
test_case.identifier: testInvalidKeyMaterial
test_case.invocations: createKey createHmacKeyData randBytes createKey createAesSivKeyData createKeysetHandle createKeyset getPrimitive fail assertExceptionContains createKeysetHandle createKeyset getPrimitive fail assertExceptionContains
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInvalidKeyMaterial()
focal_class.file: java_src/src/main/java/com/google/crypto/tink/mac/MacFactory.java
focal_class.identifier: MacFactory
focal_class.class_method_signature: MacFactory.getPrimitive(KeysetHandle keysetHandle)
focal_class.full_signature: @Deprecated public static Mac getPrimitive(KeysetHandle keysetHandle)
focal_class.identifier: getPrimitive
focal_class.modifiers: @Deprecated public static
focal_class.parameters: (KeysetHandle keysetHandle)
focal_class.return: Mac
focal_class.signature: Mac getPrimitive(KeysetHandle keysetHandle)
focal_class.class_method_signature: MacFactory.getPrimitive(KeysetHandle keysetHandle, final KeyManager<Mac> keyManager)
focal_class.full_signature: @Deprecated public static Mac getPrimitive(KeysetHandle keysetHandle, final KeyManager<Mac> keyManager)
focal_class.identifier: getPrimitive
focal_class.modifiers: @Deprecated public static
focal_class.parameters: (KeysetHandle keysetHandle, final KeyManager<Mac> keyManager)
focal_class.return: Mac
focal_class.signature: Mac getPrimitive(KeysetHandle keysetHandle, final KeyManager<Mac> keyManager)
focal_method.body: @Deprecated
    public static Mac getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException {
      return getPrimitive(keysetHandle, /* keyManager= */ null);
    }
focal_method.class_method_signature: MacFactory.getPrimitive(KeysetHandle keysetHandle)
focal_method.full_signature: @Deprecated public static Mac getPrimitive(KeysetHandle keysetHandle)
focal_method.identifier: getPrimitive
focal_method.invocations: getPrimitive
focal_method.modifiers: @Deprecated public static
focal_method.parameters: (KeysetHandle keysetHandle)
focal_method.return: Mac
focal_method.signature: Mac getPrimitive(KeysetHandle keysetHandle)