test_class.declarator: tmpFolder = new TemporaryFolder()
test_class.modifier: @Rule public
test_class.original_string: @Rule public TemporaryFolder tmpFolder = new TemporaryFolder();
test_class.type: TemporaryFolder
test_class.var_name: tmpFolder
test_class.file: java_src/src/test/java/com/google/crypto/tink/subtle/ValidatorsTest.java
test_class.identifier: ValidatorsTest
test_case.body: @Test
    public void testValidateAesKeySize() throws Exception {
      Validators.validateAesKeySize(16);
      Validators.validateAesKeySize(32);
  
      try {
        Validators.validateAesKeySize(24);
        fail("Invalid AES key size, should have thrown exception.");
      } catch (GeneralSecurityException e) {
        // Expected.
        TestUtil.assertExceptionContains(e, "invalid");
        TestUtil.assertExceptionContains(e, "key size");
      }
  
      int count = 0;
      for (int i = -100; i <= 100; i++) {
        if ((i != 16) && (i != 32)) {
          try {
            Validators.validateAesKeySize(i);
            fail("Invalid AES key size, should have thrown exception.");
          } catch (GeneralSecurityException e) {
            // Expected.
            count++;
            TestUtil.assertExceptionContains(e, "invalid");
            TestUtil.assertExceptionContains(e, "key size");
          }
        }
      }
      assertEquals(201 - 2, count);
    }
test_case.class_method_signature: ValidatorsTest.testValidateAesKeySize()
test_case.full_signature: @Test public void testValidateAesKeySize()
test_case.identifier: testValidateAesKeySize
test_case.invocations: validateAesKeySize validateAesKeySize validateAesKeySize fail assertExceptionContains assertExceptionContains validateAesKeySize fail assertExceptionContains assertExceptionContains assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidateAesKeySize()
focal_class.declarator: TYPE_URL_PREFIX = "type.googleapis.com/"
focal_class.modifier: private static final
focal_class.original_string: private static final String TYPE_URL_PREFIX = "type.googleapis.com/";
focal_class.type: String
focal_class.var_name: TYPE_URL_PREFIX
focal_class.declarator: MIN_RSA_MODULUS_SIZE = 2048
focal_class.modifier: private static final
focal_class.original_string: private static final int MIN_RSA_MODULUS_SIZE = 2048;
focal_class.type: int
focal_class.var_name: MIN_RSA_MODULUS_SIZE
focal_class.declarator: URI_UNRESERVED_CHARS = "([0-9a-zA-Z\\-\\.\\_~])+"
focal_class.modifier: private static final
focal_class.original_string: private static final String URI_UNRESERVED_CHARS = "([0-9a-zA-Z\\-\\.\\_~])+";
focal_class.type: String
focal_class.var_name: URI_UNRESERVED_CHARS
focal_class.declarator: GCP_KMS_CRYPTO_KEY_PATTERN =
        Pattern.compile(
            String.format(
                "^projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s$",
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS),
            Pattern.CASE_INSENSITIVE)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern GCP_KMS_CRYPTO_KEY_PATTERN =
        Pattern.compile(
            String.format(
                "^projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s$",
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS),
            Pattern.CASE_INSENSITIVE);
focal_class.type: Pattern
focal_class.var_name: GCP_KMS_CRYPTO_KEY_PATTERN
focal_class.declarator: GCP_KMS_CRYPTO_KEY_VERSION_PATTERN =
        Pattern.compile(
            String.format(
                "^projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s$",
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS),
            Pattern.CASE_INSENSITIVE)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern GCP_KMS_CRYPTO_KEY_VERSION_PATTERN =
        Pattern.compile(
            String.format(
                "^projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s$",
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS,
                URI_UNRESERVED_CHARS),
            Pattern.CASE_INSENSITIVE);
focal_class.type: Pattern
focal_class.var_name: GCP_KMS_CRYPTO_KEY_VERSION_PATTERN
focal_class.file: java_src/src/main/java/com/google/crypto/tink/subtle/Validators.java
focal_class.identifier: Validators
focal_class.class_method_signature: Validators.Validators()
focal_class.full_signature: private  Validators()
focal_class.identifier: Validators
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  Validators()
focal_class.class_method_signature: Validators.validateTypeUrl(String typeUrl)
focal_class.full_signature: public static void validateTypeUrl(String typeUrl)
focal_class.identifier: validateTypeUrl
focal_class.modifiers: public static
focal_class.parameters: (String typeUrl)
focal_class.return: void
focal_class.signature: void validateTypeUrl(String typeUrl)
focal_class.class_method_signature: Validators.validateAesKeySize(int sizeInBytes)
focal_class.full_signature: public static void validateAesKeySize(int sizeInBytes)
focal_class.identifier: validateAesKeySize
focal_class.modifiers: public static
focal_class.parameters: (int sizeInBytes)
focal_class.return: void
focal_class.signature: void validateAesKeySize(int sizeInBytes)
focal_class.class_method_signature: Validators.validateVersion(int candidate, int maxExpected)
focal_class.full_signature: public static void validateVersion(int candidate, int maxExpected)
focal_class.identifier: validateVersion
focal_class.modifiers: public static
focal_class.parameters: (int candidate, int maxExpected)
focal_class.return: void
focal_class.signature: void validateVersion(int candidate, int maxExpected)
focal_class.class_method_signature: Validators.validateSignatureHash(HashType hash)
focal_class.full_signature: public static void validateSignatureHash(HashType hash)
focal_class.identifier: validateSignatureHash
focal_class.modifiers: public static
focal_class.parameters: (HashType hash)
focal_class.return: void
focal_class.signature: void validateSignatureHash(HashType hash)
focal_class.class_method_signature: Validators.validateRsaModulusSize(int modulusSize)
focal_class.full_signature: public static void validateRsaModulusSize(int modulusSize)
focal_class.identifier: validateRsaModulusSize
focal_class.modifiers: public static
focal_class.parameters: (int modulusSize)
focal_class.return: void
focal_class.signature: void validateRsaModulusSize(int modulusSize)
focal_class.class_method_signature: Validators.validateRsaPublicExponent(
        BigInteger publicExponent)
focal_class.full_signature: public static void validateRsaPublicExponent(
        BigInteger publicExponent)
focal_class.identifier: validateRsaPublicExponent
focal_class.modifiers: public static
focal_class.parameters: (
        BigInteger publicExponent)
focal_class.return: void
focal_class.signature: void validateRsaPublicExponent(
        BigInteger publicExponent)
focal_class.class_method_signature: Validators.validateNotExists(File f)
focal_class.full_signature: public static void validateNotExists(File f)
focal_class.identifier: validateNotExists
focal_class.modifiers: public static
focal_class.parameters: (File f)
focal_class.return: void
focal_class.signature: void validateNotExists(File f)
focal_class.class_method_signature: Validators.validateExists(File f)
focal_class.full_signature: public static void validateExists(File f)
focal_class.identifier: validateExists
focal_class.modifiers: public static
focal_class.parameters: (File f)
focal_class.return: void
focal_class.signature: void validateExists(File f)
focal_class.class_method_signature: Validators.validateKmsKeyUriAndRemovePrefix(String expectedPrefix, String kmsKeyUri)
focal_class.full_signature: public static String validateKmsKeyUriAndRemovePrefix(String expectedPrefix, String kmsKeyUri)
focal_class.identifier: validateKmsKeyUriAndRemovePrefix
focal_class.modifiers: public static
focal_class.parameters: (String expectedPrefix, String kmsKeyUri)
focal_class.return: String
focal_class.signature: String validateKmsKeyUriAndRemovePrefix(String expectedPrefix, String kmsKeyUri)
focal_class.class_method_signature: Validators.validateCryptoKeyUri(String kmsKeyUri)
focal_class.full_signature: public static void validateCryptoKeyUri(String kmsKeyUri)
focal_class.identifier: validateCryptoKeyUri
focal_class.modifiers: public static
focal_class.parameters: (String kmsKeyUri)
focal_class.return: void
focal_class.signature: void validateCryptoKeyUri(String kmsKeyUri)
focal_method.body: public static void validateAesKeySize(int sizeInBytes) throws InvalidAlgorithmParameterException {
      if (sizeInBytes != 16 && sizeInBytes != 32) {
        throw new InvalidAlgorithmParameterException(
            String.format(
                "invalid key size %d; only 128-bit and 256-bit AES keys are supported",
                sizeInBytes * 8));
      }
    }
focal_method.class_method_signature: Validators.validateAesKeySize(int sizeInBytes)
focal_method.full_signature: public static void validateAesKeySize(int sizeInBytes)
focal_method.identifier: validateAesKeySize
focal_method.invocations: format
focal_method.modifiers: public static
focal_method.parameters: (int sizeInBytes)
focal_method.return: void
focal_method.signature: void validateAesKeySize(int sizeInBytes)