Skip to content

Commit 64d9752

Browse files
authored
bpo-40849: Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag (GH-20463)
This short PR exposes an openssl flag that wasn't exposed. I've also updated to doc to reflect the change. It's heavily inspired by 990fcaa.
1 parent d37b74f commit 64d9752

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

Doc/library/ssl.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,17 @@ Constants
650650

651651
.. versionadded:: 3.4.4
652652

653+
.. data:: VERIFY_X509_PARTIAL_CHAIN
654+
655+
Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to
656+
accept intermediate CAs in the trust store to be treated as trust-anchors,
657+
in the same way as the self-signed root CA certificates. This makes it
658+
possible to trust certificates issued by an intermediate CA without having
659+
to trust its ancestor root CA.
660+
661+
.. versionadded:: 3.10
662+
663+
653664
.. class:: VerifyFlags
654665

655666
:class:`enum.IntFlag` collection of VERIFY_* constants.

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Michel Van den Bergh
157157
Julian Berman
158158
Brice Berna
159159
Olivier Bernard
160+
Vivien Bernet-Rollande
160161
Maxwell Bernstein
161162
Eric Beser
162163
Steven Bethard
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag

Modules/_ssl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5630,6 +5630,11 @@ sslmodule_init_constants(PyObject *m)
56305630
PyModule_AddIntConstant(m, "VERIFY_X509_TRUSTED_FIRST",
56315631
X509_V_FLAG_TRUSTED_FIRST);
56325632

5633+
#ifdef X509_V_FLAG_PARTIAL_CHAIN
5634+
PyModule_AddIntConstant(m, "VERIFY_X509_PARTIAL_CHAIN",
5635+
X509_V_FLAG_PARTIAL_CHAIN);
5636+
#endif
5637+
56335638
/* Alert Descriptions from ssl.h */
56345639
/* note RESERVED constants no longer intended for use have been removed */
56355640
/* http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6 */

0 commit comments

Comments
 (0)