File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ Deprecations:
1919Changes:
2020^^^^^^^^
2121
22+ - Added ``Context.set_cert_store `` `#1210 <https://github.com/pyca/pyopenssl/pull/1210 >`_.
23+
222423.2.0 (2023-05-30)
2325-------------------
2426
Original file line number Diff line number Diff line change @@ -1507,6 +1507,16 @@ def get_cert_store(self):
15071507 pystore ._store = store
15081508 return pystore
15091509
1510+ def set_cert_store (self , store ):
1511+ """
1512+ Set the certificate store for the context.
1513+ :param store: A X509Store object.
1514+ :return: None
1515+ """
1516+ rc = _lib .X509_STORE_up_ref (store ._store )
1517+ _openssl_assert (rc == 1 )
1518+ _lib .SSL_CTX_set_cert_store (self ._context , store ._store )
1519+
15101520 def set_options (self , options ):
15111521 """
15121522 Add options. Options set before are not cleared!
Original file line number Diff line number Diff line change @@ -1716,6 +1716,12 @@ def test_get_cert_store(self):
17161716 store = context .get_cert_store ()
17171717 assert isinstance (store , X509Store )
17181718
1719+ def test_set_cert_store (self ):
1720+ context = Context (SSLv23_METHOD )
1721+ store = X509Store ()
1722+ context .set_cert_store (store )
1723+ assert store ._store == context .get_cert_store ()._store
1724+
17191725 def test_set_tlsext_use_srtp_not_bytes (self ):
17201726 """
17211727 `Context.set_tlsext_use_srtp' enables negotiating SRTP keying material.
You can’t perform that action at this time.
0 commit comments