File tree Expand file tree Collapse file tree 5 files changed +32
-0
lines changed Expand file tree Collapse file tree 5 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 2525 - {VERSION: "3.9", TOXENV: "py39-cryptographyMain"}
2626 - {VERSION: "3.10", TOXENV: "py310-cryptographyMain"}
2727 - {VERSION: "3.11", TOXENV: "py311-cryptographyMain"}
28+ - {VERSION: "3.11", TOXENV: "py311-cryptography40"}
2829 - {VERSION: "pypy-3.8", TOXENV: "pypy3-cryptographyMain"}
2930 - {VERSION: "pypy-3.9", TOXENV: "pypy3-cryptographyMain"}
3031 # -cryptographyMinimum
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ Changes:
1717^^^^^^^^
1818
1919- Invalid versions are now rejected in ``OpenSSL.crypto.X509Req.set_version ``.
20+ - Added ``Context.set_cert_store `` `#1210 <https://github.com/pyca/pyopenssl/pull/1210 >`_.
2021
212223.1.1 (2023-03-28)
2223-------------------
Original file line number Diff line number Diff line change @@ -1399,6 +1399,24 @@ def get_cert_store(self):
13991399 pystore ._store = store
14001400 return pystore
14011401
1402+ def set_cert_store (self , store ):
1403+ """
1404+ Set the certificate store for the context.
1405+ :param store: A X509Store object.
1406+ :return: None
1407+ """
1408+ try :
1409+ _lib .SSL_CTX_set_cert_store (self ._context , store ._store )
1410+ # The store is now owned by the context, so we need to
1411+ # remove the gc free in the object. We do this after the
1412+ # set since set may not exist.
1413+ _ffi .gc (store ._store , None )
1414+ except AttributeError :
1415+ # This can be removed when we depend on >= 40.0.2
1416+ raise NotImplementedError (
1417+ "cryptography must be updated to call this method"
1418+ )
1419+
14021420 def set_options (self , options ):
14031421 """
14041422 Add options. Options set before are not cleared!
Original file line number Diff line number Diff line change @@ -1716,6 +1716,16 @@ 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+ try :
1722+ store = X509Store ()
1723+ context .set_cert_store (store )
1724+ assert store ._store == context .get_cert_store ()._store
1725+ except NotImplementedError :
1726+ pass
1727+
1728+
17191729 def test_set_tlsext_use_srtp_not_bytes (self ):
17201730 """
17211731 `Context.set_tlsext_use_srtp' enables negotiating SRTP keying material.
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ extras =
1919deps =
2020 coverage>=4.2
2121 cryptographyMinimum: cryptography ==38.0.0
22+ # special version to test paths for bindings we temporarily removed
23+ cryptography40: cryptography ==40.0.1
2224 randomorder: pytest-randomly
2325setenv =
2426 # Do not allow the executing environment to pollute the test environment
You can’t perform that action at this time.
0 commit comments