Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 744caa8

Browse files
authored
gh-120762: make_ssl_certs: Don't set extensions for the temporary CSR (GH-125045)
gh-120762: make_ssl_certs: Don't set extensions for the CSR `openssl req` fails with openssl 3.2.2 because the config line authorityKeyIdentifier = keyid:always,issuer:always is not supported for certificate signing requests (since the issuing certificate authority is not known). David von Oheimb, the OpenSSL dev that made the change, commented in: openssl/openssl#22966 (comment) : > This problem did not show up in older OpenSSL versions because of a bug: > the `req` app ignored the `-extensions` option unless `-x505` is given, > which I fixed in openssl/openssl#16865. (I assume `-x505` is a typo for `-x509`.) In our `make_cert_key` function: If `sign` is true: - We don't pass `-x509` to `req`, so in this case it should be safe to omit the `-extensions` argument. (Old OpenSSL ignores it, new OpenSSL fails on it.) - The extensions are passed to the `ca` call later in the function. There they take effect, and `authorityKeyIdentifier` is valid. If `sign` is false, this commit has no effect except rearranging the CLI arguments.
1 parent da071fa commit 744caa8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Lib/test/certdata/make_ssl_certs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ def make_cert_key(cmdlineargs, hostname, sign=False, extra_san='',
139139
f.write(req)
140140
args = ['req', '-new', '-nodes', '-days', cmdlineargs.days,
141141
'-newkey', key, '-keyout', key_file,
142-
'-extensions', ext,
143142
'-config', req_file]
144143
if sign:
145144
with tempfile.NamedTemporaryFile(delete=False) as f:
@@ -148,7 +147,7 @@ def make_cert_key(cmdlineargs, hostname, sign=False, extra_san='',
148147
args += ['-out', reqfile ]
149148

150149
else:
151-
args += ['-x509', '-out', cert_file ]
150+
args += ['-extensions', ext, '-x509', '-out', cert_file ]
152151
check_call(['openssl'] + args)
153152

154153
if sign:

0 commit comments

Comments
 (0)