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

Undocumented API incompatibility in EC: renamed keyword argument in EllipticCurvePrivateKey.exchange() #10294

Closed
MatthiasValvekens opened this issue Jan 30, 2024 · 2 comments

Comments

@MatthiasValvekens
Copy link

MatthiasValvekens commented Jan 30, 2024

Hi, I have the following snippet breaking on the latest version of cryptography (42.0.1):

        if isinstance(priv_key, EllipticCurvePrivateKey):
            ecdh_value = priv_key.exchange(
                ECDH(), peer_public_key=originator_pub_key
            )

Removing the usage of kwargs fixes it. Reproducible on Python 3.11, but probably the same issue exists everywhere (I can rerun my CI in fail-late mode if needed). From what I can tell, the breaking change was introduced here, in the initial migration of this code to Rust: f38eb4a#diff-868a141c8ba335a462dc768991ee88d95cad873c531d64b10a88385beac311b2R311, renaming peer_public_key to public_key. I see in the release notes for 42.0.1 that the sign function required a similar fix, so I suspect this was overlooked for similar reasons.

EDIT for completeness: the error raised is this one, on the call to exchange:

   TypeError: ECPrivateKey.exchange() got an unexpected keyword argument 'peer_public_key'

Thanks!

MatthiasValvekens added a commit to MatthiasValvekens/pyHanko that referenced this issue Jan 30, 2024
@alex
Copy link
Member

alex commented Jan 30, 2024

Thanks for the report. I think we'll try to get a fix in and then a backport quickly -- we'll be doing a releaes tomorrow.

alex added a commit to alex/cryptography that referenced this issue Jan 30, 2024
alex added a commit to alex/cryptography that referenced this issue Jan 30, 2024
@MatthiasValvekens
Copy link
Author

Thanks for the lightning-fast fix! :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants