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