AAID.java

1
package com.yubico.fido.metadata;
2
3
import com.fasterxml.jackson.annotation.JsonCreator;
4
import com.fasterxml.jackson.annotation.JsonValue;
5
import java.util.regex.Pattern;
6
import lombok.Value;
7
8
/**
9
 * Each UAF authenticator MUST have an AAID to identify UAF enabled authenticator models globally.
10
 * The AAID MUST uniquely identify a specific authenticator model within the range of all
11
 * UAF-enabled authenticator models made by all authenticator vendors, where authenticators of a
12
 * specific model must share identical security characteristics within the model (see Security
13
 * Considerations).
14
 *
15
 * <p>The AAID is a string with format <code>"V#M"</code>, where
16
 *
17
 * <ul>
18
 *   <li><code>#</code> is a separator
19
 *   <li><code>V</code> indicates the authenticator Vendor Code. This code consists of 4 hexadecimal
20
 *       digits.
21
 *   <li><code>M</code> indicates the authenticator Model Code. This code consists of 4 hexadecimal
22
 *       digits.
23
 * </ul>
24
 *
25
 * @see <a
26
 *     href="https://fidoalliance.org/specs/fido-uaf-v1.2-ps-20201020/fido-uaf-protocol-v1.2-ps-20201020.html#authenticator-attestation-id-aaid-typedef">FIDO
27
 *     UAF Protocol Specification §3.1.4 Authenticator Attestation ID (AAID) typedef</a>
28
 */
29
@Value
30
public class AAID {
31
32
  private static final Pattern AAID_PATTERN = Pattern.compile("^[0-9a-fA-F]{4}#[0-9a-fA-F]{4}$");
33
34
  /**
35
   * The underlying string value of this AAID.
36
   *
37
   * <p>The AAID is a string with format <code>"V#M"</code>, where
38
   *
39
   * <ul>
40
   *   <li><code>#</code> is a separator
41
   *   <li><code>V</code> indicates the authenticator Vendor Code. This code consists of 4
42
   *       hexadecimal digits.
43
   *   <li><code>M</code> indicates the authenticator Model Code. This code consists of 4
44
   *       hexadecimal digits.
45
   * </ul>
46
   *
47
   * @see <a
48
   *     href="https://fidoalliance.org/specs/fido-uaf-v1.2-ps-20201020/fido-uaf-protocol-v1.2-ps-20201020.html#authenticator-attestation-id-aaid-typedef">Authenticator
49
   *     Attestation ID (AAID) typedef</a>
50
   */
51
  @JsonValue String value;
52
53
  /**
54
   * Construct an {@link AAID} from its String representation.
55
   *
56
   * <p>This is the inverse of {@link #getValue()}.
57
   *
58
   * @param value a {@link String} conforming to the rules specified in the {@link AAID} type.
59
   */
60
  @JsonCreator
61
  public AAID(String value) {
62
    this.value = validate(value);
63
  }
64
65
  private String validate(String value) {
66 1 1. validate : negated conditional → KILLED
    if (AAID_PATTERN.matcher(value).matches()) {
67 1 1. validate : replaced return value with "" for com/yubico/fido/metadata/AAID::validate → KILLED
      return value;
68
    } else {
69
      throw new IllegalArgumentException(
70
          String.format("Value does not satisfy AAID format: %s", value));
71
    }
72
  }
73
}

Mutations

66

1.1
Location : validate
Killed by : com.yubico.fido.metadata.FidoMds3Spec
negated conditional → KILLED

67

1.1
Location : validate
Killed by : com.yubico.fido.metadata.FidoMds3Spec
replaced return value with "" for com/yubico/fido/metadata/AAID::validate → KILLED

Active mutators

Tests examined


Report generated by PIT 1.15.0