Skip to content

check that the public keys lie on the curve.? #271

Closed

Description

@Noname400

hello, tell me how to check that the public keys lie on the curve.?
and how to check that after the operation of multiplication I left the border of the curve?

Activity

  1. tomato42 commented on Nov 27, 2021

    @tomato42
    Member

    All the public methods in VerifyingKey check if the public key lies on the curve, it's controlled by the validate_point option like:

    def from_public_point(
    cls, point, curve=NIST192p, hashfunc=sha1, validate_point=True
    ):

    or:
    def from_string(
    cls,
    string,
    curve=NIST192p,
    hashfunc=sha1,
    validate_point=True,
    valid_encodings=None,
    ):

    and how to check that after the operation of multiplication I left the border of the curve?

    if a point was on the curve before multiplication, then the result will be on the curve...

    You can double check that on high level, by exporting the point to a byte string and then create a new VerifyingKey instance, that will verify if it is on curve still.

    On low level, you need to get the CurveFp() and call contains_point() for short Weierstrass curves:

    def contains_point(self, x, y):

    or the contains_point() of CurveEdTw() for twisted Edwards curves:
    def contains_point(self, x, y):

  2. locked and limited conversation to collaborators on Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions