|
@@ -1,4 +1,4 @@
|
|
-From bf18b564122e8f976681a2398862fde1eafd84ba Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
+From a4e468a2a0afa80df174831c2f422184820bb0fa Mon Sep 17 00:00:00 2001
|
|
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
Date: Thu, 6 Jan 2022 23:15:00 +0100
|
|
Date: Thu, 6 Jan 2022 23:15:00 +0100
|
|
Subject: [PATCH] mozilla/certdata2pem.py: make cryptography module optional
|
|
Subject: [PATCH] mozilla/certdata2pem.py: make cryptography module optional
|
|
@@ -14,38 +14,39 @@ cryptography Python module is there, we perform the check, otherwise
|
|
the check is skipped.
|
|
the check is skipped.
|
|
|
|
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
|
|
+[Steve: refreshed to apply on ca-certificates version 20230311]
|
|
|
|
+Signed-off-by: Steve Hay <me@stevenhay.com>
|
|
---
|
|
---
|
|
- mozilla/certdata2pem.py | 18 ++++++++++--------
|
|
|
|
- 1 file changed, 10 insertions(+), 8 deletions(-)
|
|
|
|
|
|
+ mozilla/certdata2pem.py | 17 ++++++++++-------
|
|
|
|
+ 1 file changed, 10 insertions(+), 7 deletions(-)
|
|
|
|
|
|
diff --git a/mozilla/certdata2pem.py b/mozilla/certdata2pem.py
|
|
diff --git a/mozilla/certdata2pem.py b/mozilla/certdata2pem.py
|
|
-index ede23d4..a6261f8 100644
|
|
|
|
|
|
+index 4df86a2..3a6d7dc 100644
|
|
--- a/mozilla/certdata2pem.py
|
|
--- a/mozilla/certdata2pem.py
|
|
+++ b/mozilla/certdata2pem.py
|
|
+++ b/mozilla/certdata2pem.py
|
|
-@@ -28,9 +28,6 @@ import sys
|
|
|
|
|
|
+@@ -28,8 +28,6 @@ import sys
|
|
import textwrap
|
|
import textwrap
|
|
import io
|
|
import io
|
|
|
|
|
|
-from cryptography import x509
|
|
-from cryptography import x509
|
|
-
|
|
-
|
|
--
|
|
|
|
|
|
+
|
|
objects = []
|
|
objects = []
|
|
|
|
|
|
- # Dirty file parser.
|
|
|
|
-@@ -122,11 +119,16 @@ for obj in objects:
|
|
|
|
|
|
+@@ -122,11 +120,16 @@ for obj in objects:
|
|
if not obj['CKA_LABEL'] in trust or not trust[obj['CKA_LABEL']]:
|
|
if not obj['CKA_LABEL'] in trust or not trust[obj['CKA_LABEL']]:
|
|
continue
|
|
continue
|
|
|
|
|
|
-- cert = x509.load_der_x509_certificate(obj['CKA_VALUE'])
|
|
|
|
-- if cert.not_valid_after < datetime.datetime.now():
|
|
|
|
|
|
+- cert = x509.load_der_x509_certificate(bytes(obj['CKA_VALUE']))
|
|
|
|
+- if cert.not_valid_after < datetime.datetime.utcnow():
|
|
- print('!'*74)
|
|
- print('!'*74)
|
|
- print('Trusted but expired certificate found: %s' % obj['CKA_LABEL'])
|
|
- print('Trusted but expired certificate found: %s' % obj['CKA_LABEL'])
|
|
- print('!'*74)
|
|
- print('!'*74)
|
|
+ try:
|
|
+ try:
|
|
+ from cryptography import x509
|
|
+ from cryptography import x509
|
|
+
|
|
+
|
|
-+ cert = x509.load_der_x509_certificate(obj['CKA_VALUE'])
|
|
|
|
-+ if cert.not_valid_after < datetime.datetime.now():
|
|
|
|
|
|
++ cert = x509.load_der_x509_certificate(bytes(obj['CKA_VALUE']))
|
|
|
|
++ if cert.not_valid_after < datetime.datetime.utcnow():
|
|
+ print('!'*74)
|
|
+ print('!'*74)
|
|
+ print('Trusted but expired certificate found: %s' % obj['CKA_LABEL'])
|
|
+ print('Trusted but expired certificate found: %s' % obj['CKA_LABEL'])
|
|
+ print('!'*74)
|
|
+ print('!'*74)
|
|
@@ -55,5 +56,5 @@ index ede23d4..a6261f8 100644
|
|
bname = obj['CKA_LABEL'][1:-1].replace('/', '_')\
|
|
bname = obj['CKA_LABEL'][1:-1].replace('/', '_')\
|
|
.replace(' ', '_')\
|
|
.replace(' ', '_')\
|
|
--
|
|
--
|
|
-2.33.1
|
|
|
|
|
|
+2.30.2
|
|
|
|
|