private static void validateNistPrivateKeyValue(
      BigInteger privateValue, ECPoint publicPoint, EciesParameters.CurveType curveType)
      throws GeneralSecurityException {
    BigInteger order = toParameterSpecNistCurve(curveType).getOrder();
    if ((privateValue.signum() <= 0) || (privateValue.compareTo(order) >= 0)) {
      throw new GeneralSecurityException("Invalid private value");
    }
    ECPoint p =
        EllipticCurvesUtil.multiplyByGenerator(privateValue, toParameterSpecNistCurve(curveType));
    if (!p.equals(publicPoint)) {
      throw new GeneralSecurityException("Invalid private value");
    }
  }
Exactly one of nistPrivateKeyValue and x25519PrivateKeyBytes is non-null.
java_src/src/main/java/com/google/crypto/tink/hybrid/EciesPrivateKey.java