public static void validAwsKmsIdentifier()

in src/main/java/com/amazonaws/encryptionsdk/internal/AwsKmsCmkArnInfo.java [86:105]


  public static void validAwsKmsIdentifier(final String identifier) {
    /* Exceptional Postcondition: Null or empty string is not a valid identifier. */
    if (identifier == null || identifier.isEmpty()) {
      throw new IllegalArgumentException("Null or empty string is not a valid Aws KMS identifier.");
    }

    /* Exceptional Postcondition: Things that start with `arn:` MUST be ARNs. */
    if (identifier.startsWith("arn:") && parseInfoFromKeyArn(identifier) == null) {
      throw new IllegalArgumentException("Invalid ARN used as an identifier.");
    }
    ;
    /* Postcondition: Raw alias starts with `alias/`. */
    if (identifier.startsWith("alias/")) return;

    /* Postcondition: There are no requirements on key ids.
     * Even thought they look like UUID, this is not required.
     * Take multi region keys: mrk-edb7fe6942894d32ac46dbb1c922d574
     */
    return;
  }