0002-mozilla-certdata2pem.py-Fix-compat-with-cryptography.patch 1.1 KB

1234567891011121314151617181920212223242526272829
  1. From 5e493ca307a031e81528ceddb96f3da40bc062cf Mon Sep 17 00:00:00 2001
  2. From: Wataru Ashihara <wsh@iij.ad.jp>
  3. Date: Wed, 2 Nov 2022 12:40:05 -0400
  4. Subject: [PATCH] mozilla/certdata2pem.py: Fix compat with cryptography > 3.0
  5. In newer cryptography packages, load_der_x509_certificate is enforced to be 'bytes' rather than currently used 'bytearray'. This fixes that.
  6. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008244
  7. Signed-off-by: Justin Wood <jwood@starry.com>
  8. ---
  9. mozilla/certdata2pem.py | 2 +-
  10. 1 file changed, 1 insertion(+), 1 deletion(-)
  11. diff --git a/mozilla/certdata2pem.py b/mozilla/certdata2pem.py
  12. index a6261f8..c0fa52c 100644
  13. --- a/mozilla/certdata2pem.py
  14. +++ b/mozilla/certdata2pem.py
  15. @@ -122,7 +122,7 @@ for obj in objects:
  16. try:
  17. from cryptography import x509
  18. - cert = x509.load_der_x509_certificate(obj['CKA_VALUE'])
  19. + cert = x509.load_der_x509_certificate(bytes(obj['CKA_VALUE']))
  20. if cert.not_valid_after < datetime.datetime.now():
  21. print('!'*74)
  22. print('Trusted but expired certificate found: %s' % obj['CKA_LABEL'])
  23. --
  24. 2.38.1