mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
gh-100372: Use BIO_eof to detect EOF for SSL_FILETYPE_ASN1 (GH-100373)
In PEM, we need to parse until error and then suppress `PEM_R_NO_START_LINE`, because PEM allows arbitrary leading and trailing data. DER, however, does not. Parsing until error and suppressing `ASN1_R_HEADER_TOO_LONG` doesn't quite work because that error also covers some cases that should be rejected. Instead, check `BIO_eof` early and stop the loop that way. Automerge-Triggered-By: GH:Yhg1s
This commit is contained in:
parent
6a1c49a717
commit
acfe02f3b0
3 changed files with 10 additions and 4 deletions
|
|
@ -1289,6 +1289,8 @@ class ContextTests(unittest.TestCase):
|
|||
"not enough data: cadata does not contain a certificate"
|
||||
):
|
||||
ctx.load_verify_locations(cadata=b"broken")
|
||||
with self.assertRaises(ssl.SSLError):
|
||||
ctx.load_verify_locations(cadata=cacert_der + b"A")
|
||||
|
||||
@unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
|
||||
def test_load_dh_params(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue