dns/_tls_util.py
raw| 1 | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license |
| 2 | |
| 3 | import os |
| 4 | from typing import Tuple |
| 5 | |
| 6 | |
| 7 | def convert_verify_to_cafile_and_capath( |
| 8 | verify: bool | str, |
| 9 | ) -> Tuple[str | None, str | None]: |
| 10 | cafile: str | None = None |
| 11 | capath: str | None = None |
| 12 | if isinstance(verify, str): |
| 13 | if os.path.isfile(verify): |
| 14 | cafile = verify |
| 15 | elif os.path.isdir(verify): |
| 16 | capath = verify |
| 17 | else: |
| 18 | raise ValueError("invalid verify string") |
| 19 | return cafile, capath |