@RestrictedApi(
      explanation = "Accessing parts of keys can produce unexpected incompatibilities, annotate the function with @AccessesPartialKey",
      link = "https://developers.google.com/tink/design/access_control#accessing_partial_keys",
      allowedOnPath = ".*Test\\.java",
      allowlistAnnotations = {AccessesPartialKey.class})
  public static PrfBasedKeyDerivationKey create(
      PrfBasedKeyDerivationParameters parameters, PrfKey prfKey, @Nullable Integer idRequirement)
      throws GeneralSecurityException {
    if (!parameters.getPrfParameters().equals(prfKey.getParameters())) {
      throw new GeneralSecurityException(
          "PrfParameters of passed in PrfBasedKeyDerivationParameters and passed in prfKey"
              + " parameters object must match. DerivationParameters gave: "
              + parameters.getPrfParameters()
              + ", key gives: "
              + prfKey.getParameters());
    }
    if (parameters.getDerivedKeyParameters().hasIdRequirement()) {
      if (idRequirement == null) {
        throw new GeneralSecurityException(
            "Derived key has an ID requirement, but no idRequirement was passed in on creation of"
                + " this key");
      }
    }
    if (!parameters.getDerivedKeyParameters().hasIdRequirement()) {
      if (idRequirement != null) {
        throw new GeneralSecurityException(
            "Derived key has no ID requirement, but idRequirement was passed in on creation of"
                + " this key");
      }
    }
    return new PrfBasedKeyDerivationKey(parameters, prfKey, idRequirement);
  }
Represents a Derivation key which is based on a PRF.

<p>An object of this class represents the map which 1) uses the given PRF (as specified by {@link
#getPrfKey}) to get sufficient key material from the salt, then 2) creates a key for the
parameters as specified in {@code getParameters().getDerivedKeyParameters()}.
java_src/src/main/java/com/google/crypto/tink/keyderivation/PrfBasedKeyDerivationKey.java