static void checkPublicKey(ECPublicKey key) throws GeneralSecurityException {
    EllipticCurvesUtil.checkPointOnCurve(key.getW(), key.getParams().getCurve());
  }
Checks that the point of the public key is on the curve of the public key.

<h3>Warning</h3>

<p>Please use {@link #validatePublicKey} if you want to validate a public key to avoid invalid
curve attacks or small subgroup attacks in ECDH.

<p>This is a sanity check, because the curve of the public key might be under control of the
adversary.

@param key must be a key defined over a curve using a prime order field.
@throws GeneralSecurityException if the key is not valid.
java_src/src/main/java/com/google/crypto/tink/subtle/EllipticCurves.java