@AccessesPartialKey
  @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 EciesPrivateKey createForCurveX25519(
      EciesPublicKey publicKey, SecretBytes x25519PrivateKeyBytes) throws GeneralSecurityException {
    if (publicKey == null) {
      throw new GeneralSecurityException(
          "ECIES private key cannot be constructed without an ECIES public key");
    }
    if (publicKey.getX25519CurvePointBytes() == null) {
      throw new GeneralSecurityException(
          "ECIES private key for X25519 curve cannot be constructed with NIST-curve public key");
    }
    if (x25519PrivateKeyBytes == null) {
      throw new GeneralSecurityException("ECIES private key cannot be constructed without secret");
    }
    validateX25519PrivateKeyBytes(
        x25519PrivateKeyBytes.toByteArray(InsecureSecretKeyAccess.get()),
        publicKey.getX25519CurvePointBytes().toByteArray());

    return new EciesPrivateKey(publicKey, null, x25519PrivateKeyBytes);
  }
Creates a new ECIES private key using Curve25519.

@param publicKey Corresponding ECIES public key for this private key
@param x25519PrivateKeyBytes private key bytes
java_src/src/main/java/com/google/crypto/tink/hybrid/EciesPrivateKey.java