test_class.declarator: manager = new HmacKeyManager()
test_class.modifier: private final
test_class.original_string: private final HmacKeyManager manager = new HmacKeyManager();
test_class.type: HmacKeyManager
test_class.var_name: manager
test_class.declarator: factory = manager.keyFactory()
test_class.modifier: private final
test_class.original_string: private final KeyTypeManager.KeyFactory<HmacKeyFormat, HmacKey> factory = manager.keyFactory();
test_class.type: KeyTypeManager.KeyFactory<HmacKeyFormat, HmacKey>
test_class.var_name: factory
test_class.file: java_src/src/test/java/com/google/crypto/tink/mac/HmacKeyManagerTest.java
test_class.identifier: HmacKeyManagerTest
test_case.body: @Test
    public void validateKey_notValid_throws() throws Exception {
      HmacKey validKey = factory.createKey(makeHmacKeyFormat(16, 10, HashType.SHA1));
      try {
        manager.validateKey(
            HmacKey.newBuilder(validKey)
                .setKeyValue(ByteString.copyFrom(Random.randBytes(15)))
                .build());
        fail();
      } catch (GeneralSecurityException e) {
        // expected
      }
      try {
        manager
            .validateKey(
                HmacKey.newBuilder(validKey)
                    .setParams(HmacParams.newBuilder(validKey.getParams()).setTagSize(0).build())
                    .build());
        fail();
      } catch (GeneralSecurityException e) {
        // expected
      }
      try {
        manager
            .validateKey(
                HmacKey.newBuilder(validKey)
                    .setParams(HmacParams.newBuilder(validKey.getParams()).setTagSize(9).build())
                    .build());
        fail();
      } catch (GeneralSecurityException e) {
        // expected
      }
      try {
        manager
            .validateKey(
                HmacKey.newBuilder(validKey)
                    .setParams(HmacParams.newBuilder(validKey.getParams()).setTagSize(21).build())
                    .build());
        fail();
      } catch (GeneralSecurityException e) {
        // expected
      }
      try {
        manager
            .validateKey(
                HmacKey.newBuilder(validKey)
                    .setParams(HmacParams.newBuilder(validKey.getParams()).setTagSize(32).build())
                    .build());
        fail();
      } catch (GeneralSecurityException e) {
        // expected
      }
    }
test_case.class_method_signature: HmacKeyManagerTest.validateKey_notValid_throws()
test_case.full_signature: @Test public void validateKey_notValid_throws()
test_case.identifier: validateKey_notValid_throws
test_case.invocations: createKey makeHmacKeyFormat validateKey build setKeyValue newBuilder copyFrom randBytes fail validateKey build setParams newBuilder build setTagSize newBuilder getParams fail validateKey build setParams newBuilder build setTagSize newBuilder getParams fail validateKey build setParams newBuilder build setTagSize newBuilder getParams fail validateKey build setParams newBuilder build setTagSize newBuilder getParams fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void validateKey_notValid_throws()
focal_class.declarator: MIN_KEY_SIZE_IN_BYTES = 16
focal_class.modifier: private static final
focal_class.original_string: private static final int MIN_KEY_SIZE_IN_BYTES = 16;
focal_class.type: int
focal_class.var_name: MIN_KEY_SIZE_IN_BYTES
focal_class.declarator: MIN_TAG_SIZE_IN_BYTES = 10
focal_class.modifier: private static final
focal_class.original_string: private static final int MIN_TAG_SIZE_IN_BYTES = 10;
focal_class.type: int
focal_class.var_name: MIN_TAG_SIZE_IN_BYTES
focal_class.file: java_src/src/main/java/com/google/crypto/tink/mac/HmacKeyManager.java
focal_class.identifier: HmacKeyManager
focal_class.class_method_signature: HmacKeyManager.HmacKeyManager()
focal_class.full_signature: public  HmacKeyManager()
focal_class.identifier: HmacKeyManager
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  HmacKeyManager()
focal_class.class_method_signature: HmacKeyManager.getKeyType()
focal_class.full_signature: @Override public String getKeyType()
focal_class.identifier: getKeyType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getKeyType()
focal_class.class_method_signature: HmacKeyManager.getVersion()
focal_class.full_signature: @Override public int getVersion()
focal_class.identifier: getVersion
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getVersion()
focal_class.class_method_signature: HmacKeyManager.keyMaterialType()
focal_class.full_signature: @Override public KeyMaterialType keyMaterialType()
focal_class.identifier: keyMaterialType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: KeyMaterialType
focal_class.signature: KeyMaterialType keyMaterialType()
focal_class.class_method_signature: HmacKeyManager.validateKey(HmacKey key)
focal_class.full_signature: @Override public void validateKey(HmacKey key)
focal_class.identifier: validateKey
focal_class.modifiers: @Override public
focal_class.parameters: (HmacKey key)
focal_class.return: void
focal_class.signature: void validateKey(HmacKey key)
focal_class.class_method_signature: HmacKeyManager.parseKey(ByteString byteString)
focal_class.full_signature: @Override public HmacKey parseKey(ByteString byteString)
focal_class.identifier: parseKey
focal_class.modifiers: @Override public
focal_class.parameters: (ByteString byteString)
focal_class.return: HmacKey
focal_class.signature: HmacKey parseKey(ByteString byteString)
focal_class.class_method_signature: HmacKeyManager.validateParams(HmacParams params)
focal_class.full_signature: private static void validateParams(HmacParams params)
focal_class.identifier: validateParams
focal_class.modifiers: private static
focal_class.parameters: (HmacParams params)
focal_class.return: void
focal_class.signature: void validateParams(HmacParams params)
focal_class.class_method_signature: HmacKeyManager.keyFactory()
focal_class.full_signature: @Override public KeyFactory<HmacKeyFormat, HmacKey> keyFactory()
focal_class.identifier: keyFactory
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: KeyFactory<HmacKeyFormat, HmacKey>
focal_class.signature: KeyFactory<HmacKeyFormat, HmacKey> keyFactory()
focal_class.class_method_signature: HmacKeyManager.register(boolean newKeyAllowed)
focal_class.full_signature: public static void register(boolean newKeyAllowed)
focal_class.identifier: register
focal_class.modifiers: public static
focal_class.parameters: (boolean newKeyAllowed)
focal_class.return: void
focal_class.signature: void register(boolean newKeyAllowed)
focal_class.class_method_signature: HmacKeyManager.hmacSha256HalfDigestTemplate()
focal_class.full_signature: public static final KeyTemplate hmacSha256HalfDigestTemplate()
focal_class.identifier: hmacSha256HalfDigestTemplate
focal_class.modifiers: public static final
focal_class.parameters: ()
focal_class.return: KeyTemplate
focal_class.signature: KeyTemplate hmacSha256HalfDigestTemplate()
focal_class.class_method_signature: HmacKeyManager.hmacSha256Template()
focal_class.full_signature: public static final KeyTemplate hmacSha256Template()
focal_class.identifier: hmacSha256Template
focal_class.modifiers: public static final
focal_class.parameters: ()
focal_class.return: KeyTemplate
focal_class.signature: KeyTemplate hmacSha256Template()
focal_class.class_method_signature: HmacKeyManager.hmacSha512HalfDigestTemplate()
focal_class.full_signature: public static final KeyTemplate hmacSha512HalfDigestTemplate()
focal_class.identifier: hmacSha512HalfDigestTemplate
focal_class.modifiers: public static final
focal_class.parameters: ()
focal_class.return: KeyTemplate
focal_class.signature: KeyTemplate hmacSha512HalfDigestTemplate()
focal_class.class_method_signature: HmacKeyManager.hmacSha512Template()
focal_class.full_signature: public static final KeyTemplate hmacSha512Template()
focal_class.identifier: hmacSha512Template
focal_class.modifiers: public static final
focal_class.parameters: ()
focal_class.return: KeyTemplate
focal_class.signature: KeyTemplate hmacSha512Template()
focal_class.class_method_signature: HmacKeyManager.createTemplate(int keySize, int tagSize, HashType hashType)
focal_class.full_signature: private static KeyTemplate createTemplate(int keySize, int tagSize, HashType hashType)
focal_class.identifier: createTemplate
focal_class.modifiers: private static
focal_class.parameters: (int keySize, int tagSize, HashType hashType)
focal_class.return: KeyTemplate
focal_class.signature: KeyTemplate createTemplate(int keySize, int tagSize, HashType hashType)
focal_class.superclass: extends KeyTypeManager<HmacKey>
focal_method.body: @Override
    public void validateKey(HmacKey key) throws GeneralSecurityException {
      Validators.validateVersion(key.getVersion(), getVersion());
      if (key.getKeyValue().size() < MIN_KEY_SIZE_IN_BYTES) {
        throw new GeneralSecurityException("key too short");
      }
      validateParams(key.getParams());
    }
focal_method.class_method_signature: HmacKeyManager.validateKey(HmacKey key)
focal_method.full_signature: @Override public void validateKey(HmacKey key)
focal_method.identifier: validateKey
focal_method.invocations: validateVersion getVersion getVersion size getKeyValue validateParams getParams
focal_method.modifiers: @Override public
focal_method.parameters: (HmacKey key)
focal_method.return: void
focal_method.signature: void validateKey(HmacKey key)