public static ECPoint validatePoint(ECPoint p) { if (!p.isValid()) { throw new IllegalArgumentException("Invalid point"); } return p; }
public static ECPoint validatePoint(ECPoint p) { if (!p.isValid()) { throw new IllegalStateException("Invalid point"); } return p; }
public ECPoint validatePoint(BigInteger x, BigInteger y) { ECPoint p = createPoint(x, y); if (!p.isValid()) { throw new IllegalArgumentException("Invalid point coordinates"); } return p; }
public ECPoint validatePoint(BigInteger x, BigInteger y) { ECPoint p = createPoint(x, y); if (!p.isValid()) { throw new IllegalArgumentException("Invalid point coordinates"); } return p; }
/** * @deprecated per-point compression property will be removed, use {@link #validatePoint(BigInteger, BigInteger)} * and refer {@link ECPoint#getEncoded(boolean)} */ public ECPoint validatePoint(BigInteger x, BigInteger y, boolean withCompression) { ECPoint p = createPoint(x, y, withCompression); if (!p.isValid()) { throw new IllegalArgumentException("Invalid point coordinates"); } return p; }
/** * @deprecated per-point compression property will be removed, use {@link #validatePoint(BigInteger, BigInteger)} * and refer {@link ECPoint#getEncoded(boolean)} */ public ECPoint validatePoint(BigInteger x, BigInteger y, boolean withCompression) { ECPoint p = createPoint(x, y, withCompression); if (!p.isValid()) { throw new IllegalArgumentException("Invalid point coordinates"); } return p; }
public static Optional<ECCurvePoint> create(BigInteger x, BigInteger y, String curveName) { X9ECParameters x9ECParameters = ECAssistant.x9ECParameters(curveName); ECPoint Q = x9ECParameters.getCurve() .createPoint(x, y); if (!Q.isValid()) { logger.warn("-- create() - bad Q: {} curve: {}", Q, curveName); return Optional.empty(); } ECCurvePoint point = new ECCurvePoint(Q, curveName, x9ECParameters); return Optional.of(point); }
static ECPoint validate(ECCurve c, ECPoint q) { if (q == null) { throw new IllegalArgumentException("Point has null value"); } q = ECAlgorithms.importPoint(c, q).normalize(); if (q.isInfinity()) { throw new IllegalArgumentException("Point at infinity"); } if (!q.isValid()) { throw new IllegalArgumentException("Point not on curve"); } return q; } }