File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,21 @@ Deprecations:
1616Changes:
1717^^^^^^^^
1818
19+ 23.1.1 (2023-03-28)
20+ -------------------
21+
22+ Backward-incompatible changes:
23+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+ Deprecations:
26+ ^^^^^^^^^^^^^
27+
28+ Changes:
29+ ^^^^^^^^
30+
31+ - Worked around an issue in OpenSSL 3.1.0 which caused `X509Extension.get_short_name ` to raise an exception when no short name was known to OpenSSL.
32+ `#1204 <https://github.com/pyca/pyopenssl/pull/1204 >`_.
33+
193423.1.0 (2023-03-24)
2035-------------------
2136
@@ -56,7 +71,7 @@ Backward-incompatible changes:
5671^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5772
5873- Remove support for SSLv2 and SSLv3.
59- - The minimum ``cryptography `` version is now 38.0.x (and we now pin releases
74+ - The minimum ``cryptography `` version is now 38.0.x (and we now pin releases
6075 against ``cryptography `` major versions to prevent future breakage)
6176- The ``OpenSSL.crypto.X509StoreContextError `` exception has been refactored,
6277 changing its internal attributes.
Original file line number Diff line number Diff line change @@ -904,7 +904,14 @@ def get_short_name(self) -> bytes:
904904 """
905905 obj = _lib .X509_EXTENSION_get_object (self ._extension )
906906 nid = _lib .OBJ_obj2nid (obj )
907- return _ffi .string (_lib .OBJ_nid2sn (nid ))
907+ # OpenSSL 3.1.0 has a bug where nid2sn returns NULL for NIDs that
908+ # previously returned UNDEF. This is a workaround for that issue.
909+ # https://github.com/openssl/openssl/commit/908ba3ed9adbb3df90f76
910+ buf = _lib .OBJ_nid2sn (nid )
911+ if buf != _ffi .NULL :
912+ return _ffi .string (buf )
913+ else :
914+ return b"UNDEF"
908915
909916 def get_data (self ) -> bytes :
910917 """
Original file line number Diff line number Diff line change @@ -1681,6 +1681,14 @@ def test_get_extensions(self):
16811681 exts = request .get_extensions ()
16821682 assert len (exts ) == 2
16831683
1684+ def test_undef_oid (self ):
1685+ assert (
1686+ X509Extension (
1687+ b"1.2.3.4.5.6.7" , False , b"DER:05:00"
1688+ ).get_short_name ()
1689+ == b"UNDEF"
1690+ )
1691+
16841692 def test_add_extensions_wrong_args (self ):
16851693 """
16861694 `X509Req.add_extensions` raises `TypeError` if called with a
You can’t perform that action at this time.
0 commit comments