Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support explicit curve params #252

Merged
merged 8 commits into from
May 26, 2021

Conversation

tomato42
Copy link
Member

@tomato42 tomato42 commented Apr 29, 2021

Add support for reading and writing curve parameters.

TODO:

  • reading and writing DER EC params
  • reading and writing PEM EC params
  • reading and writing VerifyingKey with explicit params
  • reading and writing SigningKey with explicit params

fixes #39

@tomato42 tomato42 added the feature functionality to be implemented label Apr 29, 2021
@tomato42 tomato42 added this to the v0.17.0 milestone Apr 29, 2021
@tomato42 tomato42 self-assigned this Apr 29, 2021
@lgtm-com
Copy link

lgtm-com bot commented Apr 29, 2021

This pull request introduces 3 alerts when merging b6755ff into b4c4203 - view on LGTM.com

new alerts:

  • 2 for Module-level cyclic import
  • 1 for Unused import

@tomato42 tomato42 force-pushed the explicit-curve-params branch 4 times, most recently from 2b8db09 to 2f355cc Compare May 1, 2021 18:51
@tomato42 tomato42 requested a review from ep69 May 5, 2021 11:02
src/ecdsa/curves.py Show resolved Hide resolved
src/ecdsa/curves.py Show resolved Hide resolved
:term:`uncompressed`, :term:`compressed`, and :term:`hybrid` encodings.

Note: generally you will want to call the from_bytes method of
either a child class, either PointJacobi or Point.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too much "either", please rephrase.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

:return: x and y coordinates of the encoded point
:rtype: tuple(int, int)
"""
if valid_encodings is None:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also make sure there is nothing unexpected in valid_encodings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

src/ecdsa/ellipticcurve.py Show resolved Hide resolved
@classmethod
def setUpClass(cls):
# minimal, but with cofactor (excludes seed when compared to
# OpenSSL output
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

For decoding points it's not necessary to have all the data
useful for decoding public keys.

This will also make it possible to decode explicit EC parameters,
as decoding of a public key requires knowledge of the curve's base
point and the base point is in defined in the parameters, creating
a chicken and an egg problem with using the VerifyingKey.from_string()
to parse the base point.
as some standards, like PKIX in X.509 certificates, don't allow
for explicit curve paramters, provide an API that limits the
supported formats
Copy link

@ep69 ep69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the code around my previous comments, no objections.

@tomato42 tomato42 merged commit 634e5b0 into tlsfuzzer:master May 26, 2021
@tomato42 tomato42 deleted the explicit-curve-params branch May 26, 2021 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature functionality to be implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for keys generated by ecdsatool (explicit curve parameters)
2 participants