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

"CryptographyDeprecationWarning: Parsed a negative serial number, which is disallowed by RFC 5280" #656

Open
thbar opened this issue Jul 13, 2024 · 3 comments
Labels

Comments

@thbar
Copy link

thbar commented Jul 13, 2024

Describe the bug

Things work as expected overall, but I get a warning, both on Mac Intel & Mac Silicon.

poetry run sslyze vagrant-$$REDACTED$$:443{192.168.33.14} --certinfo

/Users/thbar/Library/Caches/pypoetry/virtualenvs/ansible-REDACTED-py3.12/lib/python3.12/site-packages/sslyze/plugins/certificate_info/trust_stores/trust_store.py:55: CryptographyDeprecationWarning: Parsed a negative serial number, which is disallowed by RFC 5280. Loading this certificate will cause an exception in the next release of cryptography.
  self._x509_store = Store(load_pem_x509_certificates(self.path.read_text().encode("ascii")))

To Reproduce

It appears I have a reproduction with non-vagrant domains as well:

❯ poetry run sslyze www.google.fr --certinfo 

 CHECKING CONNECTIVITY TO SERVER(S)
 ----------------------------------

   www.google.fr:443         => 172.217.20.163 
/Users/thbar/Library/Caches/pypoetry/virtualenvs/ansible-REDACTED-py3.12/lib/python3.12/site-packages/sslyze/plugins/certificate_info/trust_stores/trust_store.py:55: CryptographyDeprecationWarning: Parsed a negative serial number, which is disallowed by RFC 5280. Loading this certificate will cause an exception in the next release of cryptography.
  self._x509_store = Store(load_pem_x509_certificates(self.path.read_text().encode("ascii")))

# SNIP

Expected behavior

Same output but without the warning.

Python environment (please complete the following information):

  • OS: Mac OS Sonoma 14.5 (Silicon, but occurs on non-Silicon too)
  • Python version: 3.12.2

Additional context

Happy to provide additional output if needed!

@janbrasna
Copy link

It was added here:

Basically @pyca says "we don't like it so we're loud about it" but it was actually deemed correct to add that and keep it maintained (originally only "for some time" until all such certs get phased out, but it now seems there are some of these hardcoded in more root stores than originally thought, so I don't see them going away anytime soon…), what I don't like is the "Loading this certificate will cause an exception in the next release of cryptography" wording as no matter how I look at it, it's not true and should have been worded otherwise. Anyways it's going away at some point so it's good it raises warnings for now, to draw more attention to the issue…

More info:

So basically, yea, if there are no plans depending on cryptography beyond say v43 it's safe to ignore/silence this warning. Otherwise… plan accordingly;)

@Ricky-Tigg
Copy link

Hello. Same observavtion while executing sslyze --certinfo '[2607:f8b0:400a:807::2004]:443'.

@nabla-c0d3
Copy link
Owner

Hi ! I agree that this a problem, but there isn't much that SSLyze can do about it - it's up to pyca. I would argue that they shouldn't remove support for negative serial numbers as it will break a bunch of tools (including SSLyze) for (to me) no obvious win.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants