@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 EciesPublicKey createForCurveX25519(
      EciesParameters parameters, Bytes publicPointBytes, @Nullable Integer idRequirement)
      throws GeneralSecurityException {
    if (!parameters.getCurveType().equals(EciesParameters.CurveType.X25519)) {
      throw new GeneralSecurityException(
          "createForCurveX25519 may only be called with parameters for curve X25519");
    }
    validateIdRequirement(parameters.getVariant(), idRequirement);
    if (publicPointBytes.size() != 32) {
      throw new GeneralSecurityException(
          "Encoded public point byte length for X25519 curve must be 32");
    }

    Bytes prefix = createOutputPrefix(parameters.getVariant(), idRequirement);

    return new EciesPublicKey(parameters, null, publicPointBytes, prefix, idRequirement);
  }
Creates a new ECIES public key using Curve25519.

@param parameters ECIES parameters for the public key
@param publicPointBytes public point coordinates in bytes.
@param idRequirement key id requirement, which must be null for {@code NO_PREFIX} variant and
    non-null for all other variants
java_src/src/main/java/com/google/crypto/tink/hybrid/EciesPublicKey.java