private static Bytes createOutputPrefix(
      HpkeParameters.Variant variant, @Nullable Integer idRequirement) {
    if (variant == HpkeParameters.Variant.NO_PREFIX) {
      return OutputPrefixUtil.EMPTY_PREFIX;
    }
    if (idRequirement == null) {
      throw new IllegalStateException(
          "idRequirement must be non-null for HpkeParameters.Variant " + variant);
    }
    if (variant == HpkeParameters.Variant.CRUNCHY) {
      return OutputPrefixUtil.getLegacyOutputPrefix(idRequirement);
    }
    if (variant == HpkeParameters.Variant.TINK) {
      return OutputPrefixUtil.getTinkOutputPrefix(idRequirement);
    }
    throw new IllegalStateException("Unknown HpkeParameters.Variant: " + variant);
  }
Validate public key according to https://www.rfc-editor.org/rfc/rfc9180.html#section-7.1.4.

<p>Specifically, validate public key lengths and NIST KEM public key values according to
Section 5.6.2.3.4 of https://doi.org/10.6028/nist.sp.800-56ar3.
java_src/src/main/java/com/google/crypto/tink/hybrid/HpkePublicKey.java