0001-ca-certificates-fix-python3-cryptography-woes-in-cer.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 3c51cb5ff1d0db41fb3288fb555c7e7055cf3e86 Mon Sep 17 00:00:00 2001
  2. From: Christian Lamparter <chunkeey@gmail.com>
  3. Date: Wed, 1 Dec 2021 14:41:31 +0100
  4. Subject: [PATCH] ca-certificates: fix python3-cryptography woes in
  5. certdata2pem.py
  6. reverts the code portion of the Debian's ca-certificate
  7. commit 033d52259172 ("mozilla/certdata2pem.py: print a warning for expired certificates.")
  8. It broke builds with the popular Ubuntu 20.04 (focal) releases.
  9. This was due to them shipping with an older python3-cryptography
  10. version which is not compatible.
  11. More concerns were raised by jow- as well:
  12. "We don't want the build to depend on the local system time anyway."
  13. Reported-by: Chen Minqiang <ptpt52@gmail.com>
  14. Reported-by: Shane Synan <digitalcircuit36939@gmail.com>
  15. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
  16. ---
  17. --- a/work/mozilla/certdata2pem.py
  18. +++ b/work/mozilla/certdata2pem.py
  19. @@ -21,16 +21,12 @@
  20. # USA.
  21. import base64
  22. -import datetime
  23. import os.path
  24. import re
  25. import sys
  26. import textwrap
  27. import io
  28. -from cryptography import x509
  29. -
  30. -
  31. objects = []
  32. # Dirty file parser.
  33. @@ -121,13 +117,6 @@ for obj in objects:
  34. if obj['CKA_CLASS'] == 'CKO_CERTIFICATE':
  35. if not obj['CKA_LABEL'] in trust or not trust[obj['CKA_LABEL']]:
  36. continue
  37. -
  38. - cert = x509.load_der_x509_certificate(obj['CKA_VALUE'])
  39. - if cert.not_valid_after < datetime.datetime.now():
  40. - print('!'*74)
  41. - print('Trusted but expired certificate found: %s' % obj['CKA_LABEL'])
  42. - print('!'*74)
  43. -
  44. bname = obj['CKA_LABEL'][1:-1].replace('/', '_')\
  45. .replace(' ', '_')\
  46. .replace('(', '=')\