Skip to content

CryptographyDeprecationWarning

Description

There's some reported errors to be aware of with certificate.py code on Python 3.10 (OpenBSD):

/usr/local/lib/python3.10/site-packages/onionprobe/certificate.py:212:
CryptographyDeprecationWarning: Properties that return a naïve datetime
object have been deprecated. Please switch to not_valid_before_utc.
  not_valid_before = cert.not_valid_before.timestamp()
/usr/local/lib/python3.10/site-packages/onionprobe/certificate.py:213:
CryptographyDeprecationWarning: Properties that return a naïve datetime
object have been deprecated. Please switch to not_valid_after_utc.
  not_valid_after  = cert.not_valid_after.timestamp()
/usr/local/lib/python3.10/site-packages/onionprobe/certificate.py:142:
CryptographyDeprecationWarning: Properties that return a naïve datetime
object have been deprecated. Please switch to not_valid_after_utc.
  'notAfter'         : cert.not_valid_after.replace(
/usr/local/lib/python3.10/site-packages/onionprobe/certificate.py:144:
CryptographyDeprecationWarning: Properties that return a naïve datetime
object have been deprecated. Please switch to not_valid_before_utc.
  'notBefore'        : cert.not_valid_before.replace(
/usr/local/lib/python3.10/site-packages/onionprobe/certificate.py:177:
CryptographyDeprecationWarning: Properties that return a naïve datetime
object have been deprecated. Please switch to not_valid_after_utc.
  not_valid_after =
cert.not_valid_after.replace(tzinfo=timezone.utc).timestamp()

Tasks

  • Fix CryptographyDeprecationWarning about certificate validation dates.

Time estimation

  • Complexity: very small (0.5 day)
  • Uncertainty: low (x1.1)
  • Reference (adapted)
Edited by Silvio Rhatto