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

Update invalid EC key test for compatibility with upcoming OpenSSL changes #7829

Closed
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/hazmat/primitives/test_ec.py
Expand Up @@ -479,7 +479,8 @@ def test_load_invalid_ec_key_from_pem(self, backend):
# BoringSSL rejects infinity points before it ever gets to us, so it
# uses a more generic error message.
match = (
"infinity" if not backend._lib.CRYPTOGRAPHY_IS_BORINGSSL else None
r'infinity|invalid form' \
if not backend._lib.CRYPTOGRAPHY_IS_BORINGSSL else None
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
r'infinity|invalid form' \
if not backend._lib.CRYPTOGRAPHY_IS_BORINGSSL else None
r"infinity|invalid form"
if not backend._lib.CRYPTOGRAPHY_IS_BORINGSSL
else None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

Now flakes seems to be fine with my changes, but fails on some other files I did not change:

  • src/cryptography/hazmat/primitives/serialization/ssh.py
  • tests/test_interfaces.py

Copy link
Member

Choose a reason for hiding this comment

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

That failure is due to a mypy version issue that was fixed on main. You are targeting the 38.0.x branch. You'll want to retarget this PR to main (it may be easiest to just close this and open a new one)

)
with pytest.raises(ValueError, match=match):
serialization.load_pem_public_key(
Expand Down