ValidatePoint() public abstract method

Validates if the point satisfies the equation of the elliptic curve.
public abstract ValidatePoint ( BigInteger x, BigInteger y ) : bool
x Granados.Mono.Math.BigInteger value of X
y Granados.Mono.Math.BigInteger value of Y
return bool
Example #1
0
        /// <summary>
        /// Parses an elliptic curve point.
        /// </summary>
        /// <param name="data">octet data</param>
        /// <param name="ec">elliptic curve domain parameters</param>
        /// <param name="p">an elliptic curve point object</param>
        /// <returns>true if parsing and validation succeeded</returns>
        public static bool Parse(byte[] data, EllipticCurve ec, out ECPoint p) {
            if (IsZero(data)) {
                // point at infinity
                p = null;
                return false;
            }

            if (data.Length < 2) {
                // invalid length
                p = null;
                return false;
            }

            if (data[0] == 0x04) {
                ECPoint tmp = ParseUncompressed(data);
                if (tmp == null) {
                    p = null;
                    return false;
                }
                if (!ec.ValidatePoint(tmp)) {
                    p = null;
                    return false;
                }
                p = tmp;
                p.Validated = true;
                return true;
            }

            // Compressed form of EC point is not supported.
            // OpenSSL, which is used by OpenSSH for cryptography, disables
            // EC point compression by default due to the patent reason.

            p = null;
            return false;
        }