cli-ih 0.6.3__py3-none-any.whl → 0.6.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cli_ih/asyncClient.py +13 -7
- cli_ih/client.py +13 -6
- {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/METADATA +1 -1
- cli_ih-0.6.3.1.dist-info/RECORD +425 -0
- {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/WHEEL +1 -1
- {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/top_level.txt +1 -0
- venv/Lib/site-packages/__editable___cli_ih_0_6_3_1_finder.py +85 -0
- venv/Lib/site-packages/pip/__init__.py +13 -0
- venv/Lib/site-packages/pip/__main__.py +24 -0
- venv/Lib/site-packages/pip/__pip-runner__.py +50 -0
- venv/Lib/site-packages/pip/_internal/__init__.py +18 -0
- venv/Lib/site-packages/pip/_internal/build_env.py +349 -0
- venv/Lib/site-packages/pip/_internal/cache.py +291 -0
- venv/Lib/site-packages/pip/_internal/cli/__init__.py +3 -0
- venv/Lib/site-packages/pip/_internal/cli/autocompletion.py +184 -0
- venv/Lib/site-packages/pip/_internal/cli/base_command.py +244 -0
- venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py +1138 -0
- venv/Lib/site-packages/pip/_internal/cli/command_context.py +28 -0
- venv/Lib/site-packages/pip/_internal/cli/index_command.py +175 -0
- venv/Lib/site-packages/pip/_internal/cli/main.py +80 -0
- venv/Lib/site-packages/pip/_internal/cli/main_parser.py +134 -0
- venv/Lib/site-packages/pip/_internal/cli/parser.py +298 -0
- venv/Lib/site-packages/pip/_internal/cli/progress_bars.py +151 -0
- venv/Lib/site-packages/pip/_internal/cli/req_command.py +351 -0
- venv/Lib/site-packages/pip/_internal/cli/spinners.py +235 -0
- venv/Lib/site-packages/pip/_internal/cli/status_codes.py +6 -0
- venv/Lib/site-packages/pip/_internal/commands/__init__.py +139 -0
- venv/Lib/site-packages/pip/_internal/commands/cache.py +231 -0
- venv/Lib/site-packages/pip/_internal/commands/check.py +66 -0
- venv/Lib/site-packages/pip/_internal/commands/completion.py +135 -0
- venv/Lib/site-packages/pip/_internal/commands/configuration.py +288 -0
- venv/Lib/site-packages/pip/_internal/commands/debug.py +203 -0
- venv/Lib/site-packages/pip/_internal/commands/download.py +145 -0
- venv/Lib/site-packages/pip/_internal/commands/freeze.py +107 -0
- venv/Lib/site-packages/pip/_internal/commands/hash.py +58 -0
- venv/Lib/site-packages/pip/_internal/commands/help.py +40 -0
- venv/Lib/site-packages/pip/_internal/commands/index.py +159 -0
- venv/Lib/site-packages/pip/_internal/commands/inspect.py +92 -0
- venv/Lib/site-packages/pip/_internal/commands/install.py +798 -0
- venv/Lib/site-packages/pip/_internal/commands/list.py +400 -0
- venv/Lib/site-packages/pip/_internal/commands/lock.py +170 -0
- venv/Lib/site-packages/pip/_internal/commands/search.py +178 -0
- venv/Lib/site-packages/pip/_internal/commands/show.py +231 -0
- venv/Lib/site-packages/pip/_internal/commands/uninstall.py +113 -0
- venv/Lib/site-packages/pip/_internal/commands/wheel.py +181 -0
- venv/Lib/site-packages/pip/_internal/configuration.py +397 -0
- venv/Lib/site-packages/pip/_internal/distributions/__init__.py +21 -0
- venv/Lib/site-packages/pip/_internal/distributions/base.py +55 -0
- venv/Lib/site-packages/pip/_internal/distributions/installed.py +33 -0
- venv/Lib/site-packages/pip/_internal/distributions/sdist.py +165 -0
- venv/Lib/site-packages/pip/_internal/distributions/wheel.py +44 -0
- venv/Lib/site-packages/pip/_internal/exceptions.py +881 -0
- venv/Lib/site-packages/pip/_internal/index/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/index/collector.py +489 -0
- venv/Lib/site-packages/pip/_internal/index/package_finder.py +1059 -0
- venv/Lib/site-packages/pip/_internal/index/sources.py +287 -0
- venv/Lib/site-packages/pip/_internal/locations/__init__.py +441 -0
- venv/Lib/site-packages/pip/_internal/locations/_distutils.py +173 -0
- venv/Lib/site-packages/pip/_internal/locations/_sysconfig.py +215 -0
- venv/Lib/site-packages/pip/_internal/locations/base.py +82 -0
- venv/Lib/site-packages/pip/_internal/main.py +12 -0
- venv/Lib/site-packages/pip/_internal/metadata/__init__.py +164 -0
- venv/Lib/site-packages/pip/_internal/metadata/_json.py +87 -0
- venv/Lib/site-packages/pip/_internal/metadata/base.py +685 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/__init__.py +6 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py +87 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_dists.py +223 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_envs.py +143 -0
- venv/Lib/site-packages/pip/_internal/metadata/pkg_resources.py +298 -0
- venv/Lib/site-packages/pip/_internal/models/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/models/candidate.py +25 -0
- venv/Lib/site-packages/pip/_internal/models/direct_url.py +227 -0
- venv/Lib/site-packages/pip/_internal/models/format_control.py +78 -0
- venv/Lib/site-packages/pip/_internal/models/index.py +28 -0
- venv/Lib/site-packages/pip/_internal/models/installation_report.py +57 -0
- venv/Lib/site-packages/pip/_internal/models/link.py +613 -0
- venv/Lib/site-packages/pip/_internal/models/pylock.py +188 -0
- venv/Lib/site-packages/pip/_internal/models/scheme.py +25 -0
- venv/Lib/site-packages/pip/_internal/models/search_scope.py +126 -0
- venv/Lib/site-packages/pip/_internal/models/selection_prefs.py +53 -0
- venv/Lib/site-packages/pip/_internal/models/target_python.py +122 -0
- venv/Lib/site-packages/pip/_internal/models/wheel.py +141 -0
- venv/Lib/site-packages/pip/_internal/network/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/network/auth.py +564 -0
- venv/Lib/site-packages/pip/_internal/network/cache.py +133 -0
- venv/Lib/site-packages/pip/_internal/network/download.py +342 -0
- venv/Lib/site-packages/pip/_internal/network/lazy_wheel.py +213 -0
- venv/Lib/site-packages/pip/_internal/network/session.py +528 -0
- venv/Lib/site-packages/pip/_internal/network/utils.py +98 -0
- venv/Lib/site-packages/pip/_internal/network/xmlrpc.py +61 -0
- venv/Lib/site-packages/pip/_internal/operations/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/operations/build/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/operations/build/build_tracker.py +140 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata.py +38 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata_editable.py +41 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata_legacy.py +73 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel.py +38 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel_editable.py +47 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel_legacy.py +119 -0
- venv/Lib/site-packages/pip/_internal/operations/check.py +175 -0
- venv/Lib/site-packages/pip/_internal/operations/freeze.py +259 -0
- venv/Lib/site-packages/pip/_internal/operations/install/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/operations/install/editable_legacy.py +48 -0
- venv/Lib/site-packages/pip/_internal/operations/install/wheel.py +746 -0
- venv/Lib/site-packages/pip/_internal/operations/prepare.py +742 -0
- venv/Lib/site-packages/pip/_internal/pyproject.py +182 -0
- venv/Lib/site-packages/pip/_internal/req/__init__.py +105 -0
- venv/Lib/site-packages/pip/_internal/req/constructors.py +562 -0
- venv/Lib/site-packages/pip/_internal/req/req_dependency_group.py +75 -0
- venv/Lib/site-packages/pip/_internal/req/req_file.py +620 -0
- venv/Lib/site-packages/pip/_internal/req/req_install.py +937 -0
- venv/Lib/site-packages/pip/_internal/req/req_set.py +81 -0
- venv/Lib/site-packages/pip/_internal/req/req_uninstall.py +639 -0
- venv/Lib/site-packages/pip/_internal/resolution/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/base.py +20 -0
- venv/Lib/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/legacy/resolver.py +598 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/base.py +142 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/candidates.py +582 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/factory.py +814 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +166 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/provider.py +276 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/reporter.py +85 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/requirements.py +247 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/resolver.py +336 -0
- venv/Lib/site-packages/pip/_internal/self_outdated_check.py +254 -0
- venv/Lib/site-packages/pip/_internal/utils/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/utils/_jaraco_text.py +109 -0
- venv/Lib/site-packages/pip/_internal/utils/_log.py +38 -0
- venv/Lib/site-packages/pip/_internal/utils/appdirs.py +52 -0
- venv/Lib/site-packages/pip/_internal/utils/compat.py +85 -0
- venv/Lib/site-packages/pip/_internal/utils/compatibility_tags.py +201 -0
- venv/Lib/site-packages/pip/_internal/utils/datetime.py +10 -0
- venv/Lib/site-packages/pip/_internal/utils/deprecation.py +126 -0
- venv/Lib/site-packages/pip/_internal/utils/direct_url_helpers.py +87 -0
- venv/Lib/site-packages/pip/_internal/utils/egg_link.py +81 -0
- venv/Lib/site-packages/pip/_internal/utils/entrypoints.py +88 -0
- venv/Lib/site-packages/pip/_internal/utils/filesystem.py +152 -0
- venv/Lib/site-packages/pip/_internal/utils/filetypes.py +24 -0
- venv/Lib/site-packages/pip/_internal/utils/glibc.py +102 -0
- venv/Lib/site-packages/pip/_internal/utils/hashes.py +150 -0
- venv/Lib/site-packages/pip/_internal/utils/logging.py +364 -0
- venv/Lib/site-packages/pip/_internal/utils/misc.py +765 -0
- venv/Lib/site-packages/pip/_internal/utils/packaging.py +44 -0
- venv/Lib/site-packages/pip/_internal/utils/retry.py +45 -0
- venv/Lib/site-packages/pip/_internal/utils/setuptools_build.py +149 -0
- venv/Lib/site-packages/pip/_internal/utils/subprocess.py +248 -0
- venv/Lib/site-packages/pip/_internal/utils/temp_dir.py +294 -0
- venv/Lib/site-packages/pip/_internal/utils/unpacking.py +337 -0
- venv/Lib/site-packages/pip/_internal/utils/urls.py +55 -0
- venv/Lib/site-packages/pip/_internal/utils/virtualenv.py +105 -0
- venv/Lib/site-packages/pip/_internal/utils/wheel.py +132 -0
- venv/Lib/site-packages/pip/_internal/vcs/__init__.py +15 -0
- venv/Lib/site-packages/pip/_internal/vcs/bazaar.py +130 -0
- venv/Lib/site-packages/pip/_internal/vcs/git.py +571 -0
- venv/Lib/site-packages/pip/_internal/vcs/mercurial.py +186 -0
- venv/Lib/site-packages/pip/_internal/vcs/subversion.py +335 -0
- venv/Lib/site-packages/pip/_internal/vcs/versioncontrol.py +693 -0
- venv/Lib/site-packages/pip/_internal/wheel_builder.py +334 -0
- venv/Lib/site-packages/pip/_vendor/__init__.py +117 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/__init__.py +29 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/_cmd.py +70 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/adapter.py +168 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/cache.py +75 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +8 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +145 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +48 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/controller.py +511 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/filewrapper.py +119 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/heuristics.py +157 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py +146 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/wrapper.py +43 -0
- venv/Lib/site-packages/pip/_vendor/certifi/__init__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/certifi/__main__.py +12 -0
- venv/Lib/site-packages/pip/_vendor/certifi/core.py +83 -0
- venv/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/__init__.py +13 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/__main__.py +65 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_implementation.py +209 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_lint_dependency_groups.py +59 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_pip_wrapper.py +62 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_toml_compat.py +9 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/distlib/__init__.py +33 -0
- venv/Lib/site-packages/pip/_vendor/distlib/compat.py +1137 -0
- venv/Lib/site-packages/pip/_vendor/distlib/resources.py +358 -0
- venv/Lib/site-packages/pip/_vendor/distlib/scripts.py +447 -0
- venv/Lib/site-packages/pip/_vendor/distlib/util.py +1984 -0
- venv/Lib/site-packages/pip/_vendor/distro/__init__.py +54 -0
- venv/Lib/site-packages/pip/_vendor/distro/__main__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/distro/distro.py +1403 -0
- venv/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/idna/__init__.py +45 -0
- venv/Lib/site-packages/pip/_vendor/idna/codec.py +122 -0
- venv/Lib/site-packages/pip/_vendor/idna/compat.py +15 -0
- venv/Lib/site-packages/pip/_vendor/idna/core.py +437 -0
- venv/Lib/site-packages/pip/_vendor/idna/idnadata.py +4243 -0
- venv/Lib/site-packages/pip/_vendor/idna/intranges.py +57 -0
- venv/Lib/site-packages/pip/_vendor/idna/package_data.py +1 -0
- venv/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/idna/uts46data.py +8681 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/__init__.py +55 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/exceptions.py +48 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/ext.py +170 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/fallback.py +929 -0
- venv/Lib/site-packages/pip/_vendor/packaging/__init__.py +15 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_elffile.py +109 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_manylinux.py +262 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_musllinux.py +85 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_parser.py +353 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_structures.py +61 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_tokenizer.py +195 -0
- venv/Lib/site-packages/pip/_vendor/packaging/licenses/__init__.py +145 -0
- venv/Lib/site-packages/pip/_vendor/packaging/licenses/_spdx.py +759 -0
- venv/Lib/site-packages/pip/_vendor/packaging/markers.py +362 -0
- venv/Lib/site-packages/pip/_vendor/packaging/metadata.py +862 -0
- venv/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/packaging/requirements.py +91 -0
- venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py +1019 -0
- venv/Lib/site-packages/pip/_vendor/packaging/tags.py +656 -0
- venv/Lib/site-packages/pip/_vendor/packaging/utils.py +163 -0
- venv/Lib/site-packages/pip/_vendor/packaging/version.py +582 -0
- venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py +3676 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py +631 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/__main__.py +55 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/android.py +249 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/api.py +299 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/macos.py +144 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py +272 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/version.py +21 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py +272 -0
- venv/Lib/site-packages/pip/_vendor/pygments/__init__.py +82 -0
- venv/Lib/site-packages/pip/_vendor/pygments/__main__.py +17 -0
- venv/Lib/site-packages/pip/_vendor/pygments/console.py +70 -0
- venv/Lib/site-packages/pip/_vendor/pygments/filter.py +70 -0
- venv/Lib/site-packages/pip/_vendor/pygments/filters/__init__.py +940 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatter.py +129 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatters/__init__.py +157 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatters/_mapping.py +23 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexer.py +963 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/__init__.py +362 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py +602 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/python.py +1201 -0
- venv/Lib/site-packages/pip/_vendor/pygments/modeline.py +43 -0
- venv/Lib/site-packages/pip/_vendor/pygments/plugin.py +72 -0
- venv/Lib/site-packages/pip/_vendor/pygments/regexopt.py +91 -0
- venv/Lib/site-packages/pip/_vendor/pygments/scanner.py +104 -0
- venv/Lib/site-packages/pip/_vendor/pygments/sphinxext.py +247 -0
- venv/Lib/site-packages/pip/_vendor/pygments/style.py +203 -0
- venv/Lib/site-packages/pip/_vendor/pygments/styles/__init__.py +61 -0
- venv/Lib/site-packages/pip/_vendor/pygments/styles/_mapping.py +54 -0
- venv/Lib/site-packages/pip/_vendor/pygments/token.py +214 -0
- venv/Lib/site-packages/pip/_vendor/pygments/unistring.py +153 -0
- venv/Lib/site-packages/pip/_vendor/pygments/util.py +324 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/__init__.py +31 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py +410 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py +21 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +389 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/requests/__init__.py +179 -0
- venv/Lib/site-packages/pip/_vendor/requests/__version__.py +14 -0
- venv/Lib/site-packages/pip/_vendor/requests/_internal_utils.py +50 -0
- venv/Lib/site-packages/pip/_vendor/requests/adapters.py +719 -0
- venv/Lib/site-packages/pip/_vendor/requests/api.py +157 -0
- venv/Lib/site-packages/pip/_vendor/requests/auth.py +314 -0
- venv/Lib/site-packages/pip/_vendor/requests/certs.py +17 -0
- venv/Lib/site-packages/pip/_vendor/requests/compat.py +90 -0
- venv/Lib/site-packages/pip/_vendor/requests/cookies.py +561 -0
- venv/Lib/site-packages/pip/_vendor/requests/exceptions.py +151 -0
- venv/Lib/site-packages/pip/_vendor/requests/help.py +127 -0
- venv/Lib/site-packages/pip/_vendor/requests/hooks.py +33 -0
- venv/Lib/site-packages/pip/_vendor/requests/models.py +1039 -0
- venv/Lib/site-packages/pip/_vendor/requests/packages.py +25 -0
- venv/Lib/site-packages/pip/_vendor/requests/sessions.py +831 -0
- venv/Lib/site-packages/pip/_vendor/requests/status_codes.py +128 -0
- venv/Lib/site-packages/pip/_vendor/requests/structures.py +99 -0
- venv/Lib/site-packages/pip/_vendor/requests/utils.py +1086 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/__init__.py +27 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/providers.py +196 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/reporters.py +55 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/__init__.py +27 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/abstract.py +47 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/criterion.py +48 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/exceptions.py +57 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/resolution.py +622 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/structs.py +209 -0
- venv/Lib/site-packages/pip/_vendor/rich/__init__.py +177 -0
- venv/Lib/site-packages/pip/_vendor/rich/__main__.py +245 -0
- venv/Lib/site-packages/pip/_vendor/rich/_cell_widths.py +454 -0
- venv/Lib/site-packages/pip/_vendor/rich/_emoji_codes.py +3610 -0
- venv/Lib/site-packages/pip/_vendor/rich/_emoji_replace.py +32 -0
- venv/Lib/site-packages/pip/_vendor/rich/_export_format.py +76 -0
- venv/Lib/site-packages/pip/_vendor/rich/_extension.py +10 -0
- venv/Lib/site-packages/pip/_vendor/rich/_fileno.py +24 -0
- venv/Lib/site-packages/pip/_vendor/rich/_inspect.py +268 -0
- venv/Lib/site-packages/pip/_vendor/rich/_log_render.py +94 -0
- venv/Lib/site-packages/pip/_vendor/rich/_loop.py +43 -0
- venv/Lib/site-packages/pip/_vendor/rich/_null_file.py +69 -0
- venv/Lib/site-packages/pip/_vendor/rich/_palettes.py +309 -0
- venv/Lib/site-packages/pip/_vendor/rich/_pick.py +17 -0
- venv/Lib/site-packages/pip/_vendor/rich/_ratio.py +153 -0
- venv/Lib/site-packages/pip/_vendor/rich/_spinners.py +482 -0
- venv/Lib/site-packages/pip/_vendor/rich/_stack.py +16 -0
- venv/Lib/site-packages/pip/_vendor/rich/_timer.py +19 -0
- venv/Lib/site-packages/pip/_vendor/rich/_win32_console.py +661 -0
- venv/Lib/site-packages/pip/_vendor/rich/_windows.py +71 -0
- venv/Lib/site-packages/pip/_vendor/rich/_windows_renderer.py +56 -0
- venv/Lib/site-packages/pip/_vendor/rich/_wrap.py +93 -0
- venv/Lib/site-packages/pip/_vendor/rich/abc.py +33 -0
- venv/Lib/site-packages/pip/_vendor/rich/align.py +306 -0
- venv/Lib/site-packages/pip/_vendor/rich/ansi.py +241 -0
- venv/Lib/site-packages/pip/_vendor/rich/bar.py +93 -0
- venv/Lib/site-packages/pip/_vendor/rich/box.py +474 -0
- venv/Lib/site-packages/pip/_vendor/rich/cells.py +174 -0
- venv/Lib/site-packages/pip/_vendor/rich/color.py +621 -0
- venv/Lib/site-packages/pip/_vendor/rich/color_triplet.py +38 -0
- venv/Lib/site-packages/pip/_vendor/rich/columns.py +187 -0
- venv/Lib/site-packages/pip/_vendor/rich/console.py +2680 -0
- venv/Lib/site-packages/pip/_vendor/rich/constrain.py +37 -0
- venv/Lib/site-packages/pip/_vendor/rich/containers.py +167 -0
- venv/Lib/site-packages/pip/_vendor/rich/control.py +219 -0
- venv/Lib/site-packages/pip/_vendor/rich/default_styles.py +193 -0
- venv/Lib/site-packages/pip/_vendor/rich/diagnose.py +39 -0
- venv/Lib/site-packages/pip/_vendor/rich/emoji.py +91 -0
- venv/Lib/site-packages/pip/_vendor/rich/errors.py +34 -0
- venv/Lib/site-packages/pip/_vendor/rich/file_proxy.py +57 -0
- venv/Lib/site-packages/pip/_vendor/rich/filesize.py +88 -0
- venv/Lib/site-packages/pip/_vendor/rich/highlighter.py +232 -0
- venv/Lib/site-packages/pip/_vendor/rich/json.py +139 -0
- venv/Lib/site-packages/pip/_vendor/rich/jupyter.py +101 -0
- venv/Lib/site-packages/pip/_vendor/rich/layout.py +442 -0
- venv/Lib/site-packages/pip/_vendor/rich/live.py +400 -0
- venv/Lib/site-packages/pip/_vendor/rich/live_render.py +106 -0
- venv/Lib/site-packages/pip/_vendor/rich/logging.py +297 -0
- venv/Lib/site-packages/pip/_vendor/rich/markup.py +251 -0
- venv/Lib/site-packages/pip/_vendor/rich/measure.py +151 -0
- venv/Lib/site-packages/pip/_vendor/rich/padding.py +141 -0
- venv/Lib/site-packages/pip/_vendor/rich/pager.py +34 -0
- venv/Lib/site-packages/pip/_vendor/rich/palette.py +100 -0
- venv/Lib/site-packages/pip/_vendor/rich/panel.py +317 -0
- venv/Lib/site-packages/pip/_vendor/rich/pretty.py +1016 -0
- venv/Lib/site-packages/pip/_vendor/rich/progress.py +1715 -0
- venv/Lib/site-packages/pip/_vendor/rich/progress_bar.py +223 -0
- venv/Lib/site-packages/pip/_vendor/rich/prompt.py +400 -0
- venv/Lib/site-packages/pip/_vendor/rich/protocol.py +42 -0
- venv/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/rich/region.py +10 -0
- venv/Lib/site-packages/pip/_vendor/rich/repr.py +149 -0
- venv/Lib/site-packages/pip/_vendor/rich/rule.py +130 -0
- venv/Lib/site-packages/pip/_vendor/rich/scope.py +86 -0
- venv/Lib/site-packages/pip/_vendor/rich/screen.py +54 -0
- venv/Lib/site-packages/pip/_vendor/rich/segment.py +752 -0
- venv/Lib/site-packages/pip/_vendor/rich/spinner.py +132 -0
- venv/Lib/site-packages/pip/_vendor/rich/status.py +131 -0
- venv/Lib/site-packages/pip/_vendor/rich/style.py +796 -0
- venv/Lib/site-packages/pip/_vendor/rich/styled.py +42 -0
- venv/Lib/site-packages/pip/_vendor/rich/syntax.py +985 -0
- venv/Lib/site-packages/pip/_vendor/rich/table.py +1006 -0
- venv/Lib/site-packages/pip/_vendor/rich/terminal_theme.py +153 -0
- venv/Lib/site-packages/pip/_vendor/rich/text.py +1361 -0
- venv/Lib/site-packages/pip/_vendor/rich/theme.py +115 -0
- venv/Lib/site-packages/pip/_vendor/rich/themes.py +5 -0
- venv/Lib/site-packages/pip/_vendor/rich/traceback.py +899 -0
- venv/Lib/site-packages/pip/_vendor/rich/tree.py +257 -0
- venv/Lib/site-packages/pip/_vendor/tomli/__init__.py +8 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_parser.py +770 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_re.py +112 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_types.py +10 -0
- venv/Lib/site-packages/pip/_vendor/tomli/py.typed +1 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/__init__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/_writer.py +229 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/py.typed +1 -0
- venv/Lib/site-packages/pip/_vendor/truststore/__init__.py +36 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_api.py +333 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_macos.py +571 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_openssl.py +66 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_ssl_constants.py +31 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_windows.py +567 -0
- venv/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/__init__.py +102 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/_collections.py +355 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/_version.py +2 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/connection.py +572 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/connectionpool.py +1140 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +36 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +519 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +397 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/appengine.py +314 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +130 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +518 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +920 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py +216 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/exceptions.py +323 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/fields.py +274 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/filepost.py +98 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +51 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/weakref_finalize.py +155 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/six.py +1076 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py +540 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/request.py +191 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/response.py +879 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/__init__.py +49 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/connection.py +149 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/proxy.py +57 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/queue.py +22 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/request.py +137 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/response.py +107 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/retry.py +622 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_.py +504 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.py +159 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssltransport.py +221 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/timeout.py +271 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/url.py +435 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/wait.py +152 -0
- venv/Lib/site-packages/pip/py.typed +4 -0
- cli_ih-0.6.3.dist-info/RECORD +0 -8
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
import ctypes
|
|
3
|
+
import platform
|
|
4
|
+
import ssl
|
|
5
|
+
import typing
|
|
6
|
+
from ctypes import (
|
|
7
|
+
CDLL,
|
|
8
|
+
POINTER,
|
|
9
|
+
c_bool,
|
|
10
|
+
c_char_p,
|
|
11
|
+
c_int32,
|
|
12
|
+
c_long,
|
|
13
|
+
c_uint32,
|
|
14
|
+
c_ulong,
|
|
15
|
+
c_void_p,
|
|
16
|
+
)
|
|
17
|
+
from ctypes.util import find_library
|
|
18
|
+
|
|
19
|
+
from ._ssl_constants import _set_ssl_context_verify_mode
|
|
20
|
+
|
|
21
|
+
_mac_version = platform.mac_ver()[0]
|
|
22
|
+
_mac_version_info = tuple(map(int, _mac_version.split(".")))
|
|
23
|
+
if _mac_version_info < (10, 8):
|
|
24
|
+
raise ImportError(
|
|
25
|
+
f"Only OS X 10.8 and newer are supported, not {_mac_version_info[0]}.{_mac_version_info[1]}"
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
_is_macos_version_10_14_or_later = _mac_version_info >= (10, 14)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _load_cdll(name: str, macos10_16_path: str) -> CDLL:
|
|
32
|
+
"""Loads a CDLL by name, falling back to known path on 10.16+"""
|
|
33
|
+
try:
|
|
34
|
+
# Big Sur is technically 11 but we use 10.16 due to the Big Sur
|
|
35
|
+
# beta being labeled as 10.16.
|
|
36
|
+
path: str | None
|
|
37
|
+
if _mac_version_info >= (10, 16):
|
|
38
|
+
path = macos10_16_path
|
|
39
|
+
else:
|
|
40
|
+
path = find_library(name)
|
|
41
|
+
if not path:
|
|
42
|
+
raise OSError # Caught and reraised as 'ImportError'
|
|
43
|
+
return CDLL(path, use_errno=True)
|
|
44
|
+
except OSError:
|
|
45
|
+
raise ImportError(f"The library {name} failed to load") from None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
Security = _load_cdll(
|
|
49
|
+
"Security", "/System/Library/Frameworks/Security.framework/Security"
|
|
50
|
+
)
|
|
51
|
+
CoreFoundation = _load_cdll(
|
|
52
|
+
"CoreFoundation",
|
|
53
|
+
"/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation",
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
Boolean = c_bool
|
|
57
|
+
CFIndex = c_long
|
|
58
|
+
CFStringEncoding = c_uint32
|
|
59
|
+
CFData = c_void_p
|
|
60
|
+
CFString = c_void_p
|
|
61
|
+
CFArray = c_void_p
|
|
62
|
+
CFMutableArray = c_void_p
|
|
63
|
+
CFError = c_void_p
|
|
64
|
+
CFType = c_void_p
|
|
65
|
+
CFTypeID = c_ulong
|
|
66
|
+
CFTypeRef = POINTER(CFType)
|
|
67
|
+
CFAllocatorRef = c_void_p
|
|
68
|
+
|
|
69
|
+
OSStatus = c_int32
|
|
70
|
+
|
|
71
|
+
CFErrorRef = POINTER(CFError)
|
|
72
|
+
CFDataRef = POINTER(CFData)
|
|
73
|
+
CFStringRef = POINTER(CFString)
|
|
74
|
+
CFArrayRef = POINTER(CFArray)
|
|
75
|
+
CFMutableArrayRef = POINTER(CFMutableArray)
|
|
76
|
+
CFArrayCallBacks = c_void_p
|
|
77
|
+
CFOptionFlags = c_uint32
|
|
78
|
+
|
|
79
|
+
SecCertificateRef = POINTER(c_void_p)
|
|
80
|
+
SecPolicyRef = POINTER(c_void_p)
|
|
81
|
+
SecTrustRef = POINTER(c_void_p)
|
|
82
|
+
SecTrustResultType = c_uint32
|
|
83
|
+
SecTrustOptionFlags = c_uint32
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
Security.SecCertificateCreateWithData.argtypes = [CFAllocatorRef, CFDataRef]
|
|
87
|
+
Security.SecCertificateCreateWithData.restype = SecCertificateRef
|
|
88
|
+
|
|
89
|
+
Security.SecCertificateCopyData.argtypes = [SecCertificateRef]
|
|
90
|
+
Security.SecCertificateCopyData.restype = CFDataRef
|
|
91
|
+
|
|
92
|
+
Security.SecCopyErrorMessageString.argtypes = [OSStatus, c_void_p]
|
|
93
|
+
Security.SecCopyErrorMessageString.restype = CFStringRef
|
|
94
|
+
|
|
95
|
+
Security.SecTrustSetAnchorCertificates.argtypes = [SecTrustRef, CFArrayRef]
|
|
96
|
+
Security.SecTrustSetAnchorCertificates.restype = OSStatus
|
|
97
|
+
|
|
98
|
+
Security.SecTrustSetAnchorCertificatesOnly.argtypes = [SecTrustRef, Boolean]
|
|
99
|
+
Security.SecTrustSetAnchorCertificatesOnly.restype = OSStatus
|
|
100
|
+
|
|
101
|
+
Security.SecPolicyCreateRevocation.argtypes = [CFOptionFlags]
|
|
102
|
+
Security.SecPolicyCreateRevocation.restype = SecPolicyRef
|
|
103
|
+
|
|
104
|
+
Security.SecPolicyCreateSSL.argtypes = [Boolean, CFStringRef]
|
|
105
|
+
Security.SecPolicyCreateSSL.restype = SecPolicyRef
|
|
106
|
+
|
|
107
|
+
Security.SecTrustCreateWithCertificates.argtypes = [
|
|
108
|
+
CFTypeRef,
|
|
109
|
+
CFTypeRef,
|
|
110
|
+
POINTER(SecTrustRef),
|
|
111
|
+
]
|
|
112
|
+
Security.SecTrustCreateWithCertificates.restype = OSStatus
|
|
113
|
+
|
|
114
|
+
Security.SecTrustGetTrustResult.argtypes = [
|
|
115
|
+
SecTrustRef,
|
|
116
|
+
POINTER(SecTrustResultType),
|
|
117
|
+
]
|
|
118
|
+
Security.SecTrustGetTrustResult.restype = OSStatus
|
|
119
|
+
|
|
120
|
+
Security.SecTrustEvaluate.argtypes = [
|
|
121
|
+
SecTrustRef,
|
|
122
|
+
POINTER(SecTrustResultType),
|
|
123
|
+
]
|
|
124
|
+
Security.SecTrustEvaluate.restype = OSStatus
|
|
125
|
+
|
|
126
|
+
Security.SecTrustRef = SecTrustRef # type: ignore[attr-defined]
|
|
127
|
+
Security.SecTrustResultType = SecTrustResultType # type: ignore[attr-defined]
|
|
128
|
+
Security.OSStatus = OSStatus # type: ignore[attr-defined]
|
|
129
|
+
|
|
130
|
+
kSecRevocationUseAnyAvailableMethod = 3
|
|
131
|
+
kSecRevocationRequirePositiveResponse = 8
|
|
132
|
+
|
|
133
|
+
CoreFoundation.CFRelease.argtypes = [CFTypeRef]
|
|
134
|
+
CoreFoundation.CFRelease.restype = None
|
|
135
|
+
|
|
136
|
+
CoreFoundation.CFGetTypeID.argtypes = [CFTypeRef]
|
|
137
|
+
CoreFoundation.CFGetTypeID.restype = CFTypeID
|
|
138
|
+
|
|
139
|
+
CoreFoundation.CFStringCreateWithCString.argtypes = [
|
|
140
|
+
CFAllocatorRef,
|
|
141
|
+
c_char_p,
|
|
142
|
+
CFStringEncoding,
|
|
143
|
+
]
|
|
144
|
+
CoreFoundation.CFStringCreateWithCString.restype = CFStringRef
|
|
145
|
+
|
|
146
|
+
CoreFoundation.CFStringGetCStringPtr.argtypes = [CFStringRef, CFStringEncoding]
|
|
147
|
+
CoreFoundation.CFStringGetCStringPtr.restype = c_char_p
|
|
148
|
+
|
|
149
|
+
CoreFoundation.CFStringGetCString.argtypes = [
|
|
150
|
+
CFStringRef,
|
|
151
|
+
c_char_p,
|
|
152
|
+
CFIndex,
|
|
153
|
+
CFStringEncoding,
|
|
154
|
+
]
|
|
155
|
+
CoreFoundation.CFStringGetCString.restype = c_bool
|
|
156
|
+
|
|
157
|
+
CoreFoundation.CFDataCreate.argtypes = [CFAllocatorRef, c_char_p, CFIndex]
|
|
158
|
+
CoreFoundation.CFDataCreate.restype = CFDataRef
|
|
159
|
+
|
|
160
|
+
CoreFoundation.CFDataGetLength.argtypes = [CFDataRef]
|
|
161
|
+
CoreFoundation.CFDataGetLength.restype = CFIndex
|
|
162
|
+
|
|
163
|
+
CoreFoundation.CFDataGetBytePtr.argtypes = [CFDataRef]
|
|
164
|
+
CoreFoundation.CFDataGetBytePtr.restype = c_void_p
|
|
165
|
+
|
|
166
|
+
CoreFoundation.CFArrayCreate.argtypes = [
|
|
167
|
+
CFAllocatorRef,
|
|
168
|
+
POINTER(CFTypeRef),
|
|
169
|
+
CFIndex,
|
|
170
|
+
CFArrayCallBacks,
|
|
171
|
+
]
|
|
172
|
+
CoreFoundation.CFArrayCreate.restype = CFArrayRef
|
|
173
|
+
|
|
174
|
+
CoreFoundation.CFArrayCreateMutable.argtypes = [
|
|
175
|
+
CFAllocatorRef,
|
|
176
|
+
CFIndex,
|
|
177
|
+
CFArrayCallBacks,
|
|
178
|
+
]
|
|
179
|
+
CoreFoundation.CFArrayCreateMutable.restype = CFMutableArrayRef
|
|
180
|
+
|
|
181
|
+
CoreFoundation.CFArrayAppendValue.argtypes = [CFMutableArrayRef, c_void_p]
|
|
182
|
+
CoreFoundation.CFArrayAppendValue.restype = None
|
|
183
|
+
|
|
184
|
+
CoreFoundation.CFArrayGetCount.argtypes = [CFArrayRef]
|
|
185
|
+
CoreFoundation.CFArrayGetCount.restype = CFIndex
|
|
186
|
+
|
|
187
|
+
CoreFoundation.CFArrayGetValueAtIndex.argtypes = [CFArrayRef, CFIndex]
|
|
188
|
+
CoreFoundation.CFArrayGetValueAtIndex.restype = c_void_p
|
|
189
|
+
|
|
190
|
+
CoreFoundation.CFErrorGetCode.argtypes = [CFErrorRef]
|
|
191
|
+
CoreFoundation.CFErrorGetCode.restype = CFIndex
|
|
192
|
+
|
|
193
|
+
CoreFoundation.CFErrorCopyDescription.argtypes = [CFErrorRef]
|
|
194
|
+
CoreFoundation.CFErrorCopyDescription.restype = CFStringRef
|
|
195
|
+
|
|
196
|
+
CoreFoundation.kCFAllocatorDefault = CFAllocatorRef.in_dll( # type: ignore[attr-defined]
|
|
197
|
+
CoreFoundation, "kCFAllocatorDefault"
|
|
198
|
+
)
|
|
199
|
+
CoreFoundation.kCFTypeArrayCallBacks = c_void_p.in_dll( # type: ignore[attr-defined]
|
|
200
|
+
CoreFoundation, "kCFTypeArrayCallBacks"
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
CoreFoundation.CFTypeRef = CFTypeRef # type: ignore[attr-defined]
|
|
204
|
+
CoreFoundation.CFArrayRef = CFArrayRef # type: ignore[attr-defined]
|
|
205
|
+
CoreFoundation.CFStringRef = CFStringRef # type: ignore[attr-defined]
|
|
206
|
+
CoreFoundation.CFErrorRef = CFErrorRef # type: ignore[attr-defined]
|
|
207
|
+
|
|
208
|
+
except AttributeError as e:
|
|
209
|
+
raise ImportError(f"Error initializing ctypes: {e}") from None
|
|
210
|
+
|
|
211
|
+
# SecTrustEvaluateWithError is macOS 10.14+
|
|
212
|
+
if _is_macos_version_10_14_or_later:
|
|
213
|
+
try:
|
|
214
|
+
Security.SecTrustEvaluateWithError.argtypes = [
|
|
215
|
+
SecTrustRef,
|
|
216
|
+
POINTER(CFErrorRef),
|
|
217
|
+
]
|
|
218
|
+
Security.SecTrustEvaluateWithError.restype = c_bool
|
|
219
|
+
except AttributeError as e:
|
|
220
|
+
raise ImportError(f"Error initializing ctypes: {e}") from None
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def _handle_osstatus(result: OSStatus, _: typing.Any, args: typing.Any) -> typing.Any:
|
|
224
|
+
"""
|
|
225
|
+
Raises an error if the OSStatus value is non-zero.
|
|
226
|
+
"""
|
|
227
|
+
if int(result) == 0:
|
|
228
|
+
return args
|
|
229
|
+
|
|
230
|
+
# Returns a CFString which we need to transform
|
|
231
|
+
# into a UTF-8 Python string.
|
|
232
|
+
error_message_cfstring = None
|
|
233
|
+
try:
|
|
234
|
+
error_message_cfstring = Security.SecCopyErrorMessageString(result, None)
|
|
235
|
+
|
|
236
|
+
# First step is convert the CFString into a C string pointer.
|
|
237
|
+
# We try the fast no-copy way first.
|
|
238
|
+
error_message_cfstring_c_void_p = ctypes.cast(
|
|
239
|
+
error_message_cfstring, ctypes.POINTER(ctypes.c_void_p)
|
|
240
|
+
)
|
|
241
|
+
message = CoreFoundation.CFStringGetCStringPtr(
|
|
242
|
+
error_message_cfstring_c_void_p, CFConst.kCFStringEncodingUTF8
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
# Quoting the Apple dev docs:
|
|
246
|
+
#
|
|
247
|
+
# "A pointer to a C string or NULL if the internal
|
|
248
|
+
# storage of theString does not allow this to be
|
|
249
|
+
# returned efficiently."
|
|
250
|
+
#
|
|
251
|
+
# So we need to get our hands dirty.
|
|
252
|
+
if message is None:
|
|
253
|
+
buffer = ctypes.create_string_buffer(1024)
|
|
254
|
+
result = CoreFoundation.CFStringGetCString(
|
|
255
|
+
error_message_cfstring_c_void_p,
|
|
256
|
+
buffer,
|
|
257
|
+
1024,
|
|
258
|
+
CFConst.kCFStringEncodingUTF8,
|
|
259
|
+
)
|
|
260
|
+
if not result:
|
|
261
|
+
raise OSError("Error copying C string from CFStringRef")
|
|
262
|
+
message = buffer.value
|
|
263
|
+
|
|
264
|
+
finally:
|
|
265
|
+
if error_message_cfstring is not None:
|
|
266
|
+
CoreFoundation.CFRelease(error_message_cfstring)
|
|
267
|
+
|
|
268
|
+
# If no message can be found for this status we come
|
|
269
|
+
# up with a generic one that forwards the status code.
|
|
270
|
+
if message is None or message == "":
|
|
271
|
+
message = f"SecureTransport operation returned a non-zero OSStatus: {result}"
|
|
272
|
+
|
|
273
|
+
raise ssl.SSLError(message)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
Security.SecTrustCreateWithCertificates.errcheck = _handle_osstatus # type: ignore[assignment]
|
|
277
|
+
Security.SecTrustSetAnchorCertificates.errcheck = _handle_osstatus # type: ignore[assignment]
|
|
278
|
+
Security.SecTrustSetAnchorCertificatesOnly.errcheck = _handle_osstatus # type: ignore[assignment]
|
|
279
|
+
Security.SecTrustGetTrustResult.errcheck = _handle_osstatus # type: ignore[assignment]
|
|
280
|
+
Security.SecTrustEvaluate.errcheck = _handle_osstatus # type: ignore[assignment]
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
class CFConst:
|
|
284
|
+
"""CoreFoundation constants"""
|
|
285
|
+
|
|
286
|
+
kCFStringEncodingUTF8 = CFStringEncoding(0x08000100)
|
|
287
|
+
|
|
288
|
+
errSecIncompleteCertRevocationCheck = -67635
|
|
289
|
+
errSecHostNameMismatch = -67602
|
|
290
|
+
errSecCertificateExpired = -67818
|
|
291
|
+
errSecNotTrusted = -67843
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def _bytes_to_cf_data_ref(value: bytes) -> CFDataRef: # type: ignore[valid-type]
|
|
295
|
+
return CoreFoundation.CFDataCreate( # type: ignore[no-any-return]
|
|
296
|
+
CoreFoundation.kCFAllocatorDefault, value, len(value)
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def _bytes_to_cf_string(value: bytes) -> CFString:
|
|
301
|
+
"""
|
|
302
|
+
Given a Python binary data, create a CFString.
|
|
303
|
+
The string must be CFReleased by the caller.
|
|
304
|
+
"""
|
|
305
|
+
c_str = ctypes.c_char_p(value)
|
|
306
|
+
cf_str = CoreFoundation.CFStringCreateWithCString(
|
|
307
|
+
CoreFoundation.kCFAllocatorDefault,
|
|
308
|
+
c_str,
|
|
309
|
+
CFConst.kCFStringEncodingUTF8,
|
|
310
|
+
)
|
|
311
|
+
return cf_str # type: ignore[no-any-return]
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def _cf_string_ref_to_str(cf_string_ref: CFStringRef) -> str | None: # type: ignore[valid-type]
|
|
315
|
+
"""
|
|
316
|
+
Creates a Unicode string from a CFString object. Used entirely for error
|
|
317
|
+
reporting.
|
|
318
|
+
Yes, it annoys me quite a lot that this function is this complex.
|
|
319
|
+
"""
|
|
320
|
+
|
|
321
|
+
string = CoreFoundation.CFStringGetCStringPtr(
|
|
322
|
+
cf_string_ref, CFConst.kCFStringEncodingUTF8
|
|
323
|
+
)
|
|
324
|
+
if string is None:
|
|
325
|
+
buffer = ctypes.create_string_buffer(1024)
|
|
326
|
+
result = CoreFoundation.CFStringGetCString(
|
|
327
|
+
cf_string_ref, buffer, 1024, CFConst.kCFStringEncodingUTF8
|
|
328
|
+
)
|
|
329
|
+
if not result:
|
|
330
|
+
raise OSError("Error copying C string from CFStringRef")
|
|
331
|
+
string = buffer.value
|
|
332
|
+
if string is not None:
|
|
333
|
+
string = string.decode("utf-8")
|
|
334
|
+
return string # type: ignore[no-any-return]
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
def _der_certs_to_cf_cert_array(certs: list[bytes]) -> CFMutableArrayRef: # type: ignore[valid-type]
|
|
338
|
+
"""Builds a CFArray of SecCertificateRefs from a list of DER-encoded certificates.
|
|
339
|
+
Responsibility of the caller to call CoreFoundation.CFRelease on the CFArray.
|
|
340
|
+
"""
|
|
341
|
+
cf_array = CoreFoundation.CFArrayCreateMutable(
|
|
342
|
+
CoreFoundation.kCFAllocatorDefault,
|
|
343
|
+
0,
|
|
344
|
+
ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks),
|
|
345
|
+
)
|
|
346
|
+
if not cf_array:
|
|
347
|
+
raise MemoryError("Unable to allocate memory!")
|
|
348
|
+
|
|
349
|
+
for cert_data in certs:
|
|
350
|
+
cf_data = None
|
|
351
|
+
sec_cert_ref = None
|
|
352
|
+
try:
|
|
353
|
+
cf_data = _bytes_to_cf_data_ref(cert_data)
|
|
354
|
+
sec_cert_ref = Security.SecCertificateCreateWithData(
|
|
355
|
+
CoreFoundation.kCFAllocatorDefault, cf_data
|
|
356
|
+
)
|
|
357
|
+
CoreFoundation.CFArrayAppendValue(cf_array, sec_cert_ref)
|
|
358
|
+
finally:
|
|
359
|
+
if cf_data:
|
|
360
|
+
CoreFoundation.CFRelease(cf_data)
|
|
361
|
+
if sec_cert_ref:
|
|
362
|
+
CoreFoundation.CFRelease(sec_cert_ref)
|
|
363
|
+
|
|
364
|
+
return cf_array # type: ignore[no-any-return]
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
@contextlib.contextmanager
|
|
368
|
+
def _configure_context(ctx: ssl.SSLContext) -> typing.Iterator[None]:
|
|
369
|
+
check_hostname = ctx.check_hostname
|
|
370
|
+
verify_mode = ctx.verify_mode
|
|
371
|
+
ctx.check_hostname = False
|
|
372
|
+
_set_ssl_context_verify_mode(ctx, ssl.CERT_NONE)
|
|
373
|
+
try:
|
|
374
|
+
yield
|
|
375
|
+
finally:
|
|
376
|
+
ctx.check_hostname = check_hostname
|
|
377
|
+
_set_ssl_context_verify_mode(ctx, verify_mode)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def _verify_peercerts_impl(
|
|
381
|
+
ssl_context: ssl.SSLContext,
|
|
382
|
+
cert_chain: list[bytes],
|
|
383
|
+
server_hostname: str | None = None,
|
|
384
|
+
) -> None:
|
|
385
|
+
certs = None
|
|
386
|
+
policies = None
|
|
387
|
+
trust = None
|
|
388
|
+
try:
|
|
389
|
+
# Only set a hostname on the policy if we're verifying the hostname
|
|
390
|
+
# on the leaf certificate.
|
|
391
|
+
if server_hostname is not None and ssl_context.check_hostname:
|
|
392
|
+
cf_str_hostname = None
|
|
393
|
+
try:
|
|
394
|
+
cf_str_hostname = _bytes_to_cf_string(server_hostname.encode("ascii"))
|
|
395
|
+
ssl_policy = Security.SecPolicyCreateSSL(True, cf_str_hostname)
|
|
396
|
+
finally:
|
|
397
|
+
if cf_str_hostname:
|
|
398
|
+
CoreFoundation.CFRelease(cf_str_hostname)
|
|
399
|
+
else:
|
|
400
|
+
ssl_policy = Security.SecPolicyCreateSSL(True, None)
|
|
401
|
+
|
|
402
|
+
policies = ssl_policy
|
|
403
|
+
if ssl_context.verify_flags & ssl.VERIFY_CRL_CHECK_CHAIN:
|
|
404
|
+
# Add explicit policy requiring positive revocation checks
|
|
405
|
+
policies = CoreFoundation.CFArrayCreateMutable(
|
|
406
|
+
CoreFoundation.kCFAllocatorDefault,
|
|
407
|
+
0,
|
|
408
|
+
ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks),
|
|
409
|
+
)
|
|
410
|
+
CoreFoundation.CFArrayAppendValue(policies, ssl_policy)
|
|
411
|
+
CoreFoundation.CFRelease(ssl_policy)
|
|
412
|
+
revocation_policy = Security.SecPolicyCreateRevocation(
|
|
413
|
+
kSecRevocationUseAnyAvailableMethod
|
|
414
|
+
| kSecRevocationRequirePositiveResponse
|
|
415
|
+
)
|
|
416
|
+
CoreFoundation.CFArrayAppendValue(policies, revocation_policy)
|
|
417
|
+
CoreFoundation.CFRelease(revocation_policy)
|
|
418
|
+
elif ssl_context.verify_flags & ssl.VERIFY_CRL_CHECK_LEAF:
|
|
419
|
+
raise NotImplementedError("VERIFY_CRL_CHECK_LEAF not implemented for macOS")
|
|
420
|
+
|
|
421
|
+
certs = None
|
|
422
|
+
try:
|
|
423
|
+
certs = _der_certs_to_cf_cert_array(cert_chain)
|
|
424
|
+
|
|
425
|
+
# Now that we have certificates loaded and a SecPolicy
|
|
426
|
+
# we can finally create a SecTrust object!
|
|
427
|
+
trust = Security.SecTrustRef()
|
|
428
|
+
Security.SecTrustCreateWithCertificates(
|
|
429
|
+
certs, policies, ctypes.byref(trust)
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
finally:
|
|
433
|
+
# The certs are now being held by SecTrust so we can
|
|
434
|
+
# release our handles for the array.
|
|
435
|
+
if certs:
|
|
436
|
+
CoreFoundation.CFRelease(certs)
|
|
437
|
+
|
|
438
|
+
# If there are additional trust anchors to load we need to transform
|
|
439
|
+
# the list of DER-encoded certificates into a CFArray.
|
|
440
|
+
ctx_ca_certs_der: list[bytes] | None = ssl_context.get_ca_certs(
|
|
441
|
+
binary_form=True
|
|
442
|
+
)
|
|
443
|
+
if ctx_ca_certs_der:
|
|
444
|
+
ctx_ca_certs = None
|
|
445
|
+
try:
|
|
446
|
+
ctx_ca_certs = _der_certs_to_cf_cert_array(ctx_ca_certs_der)
|
|
447
|
+
Security.SecTrustSetAnchorCertificates(trust, ctx_ca_certs)
|
|
448
|
+
finally:
|
|
449
|
+
if ctx_ca_certs:
|
|
450
|
+
CoreFoundation.CFRelease(ctx_ca_certs)
|
|
451
|
+
|
|
452
|
+
# We always want system certificates.
|
|
453
|
+
Security.SecTrustSetAnchorCertificatesOnly(trust, False)
|
|
454
|
+
|
|
455
|
+
# macOS 10.13 and earlier don't support SecTrustEvaluateWithError()
|
|
456
|
+
# so we use SecTrustEvaluate() which means we need to construct error
|
|
457
|
+
# messages ourselves.
|
|
458
|
+
if _is_macos_version_10_14_or_later:
|
|
459
|
+
_verify_peercerts_impl_macos_10_14(ssl_context, trust)
|
|
460
|
+
else:
|
|
461
|
+
_verify_peercerts_impl_macos_10_13(ssl_context, trust)
|
|
462
|
+
finally:
|
|
463
|
+
if policies:
|
|
464
|
+
CoreFoundation.CFRelease(policies)
|
|
465
|
+
if trust:
|
|
466
|
+
CoreFoundation.CFRelease(trust)
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
def _verify_peercerts_impl_macos_10_13(
|
|
470
|
+
ssl_context: ssl.SSLContext, sec_trust_ref: typing.Any
|
|
471
|
+
) -> None:
|
|
472
|
+
"""Verify using 'SecTrustEvaluate' API for macOS 10.13 and earlier.
|
|
473
|
+
macOS 10.14 added the 'SecTrustEvaluateWithError' API.
|
|
474
|
+
"""
|
|
475
|
+
sec_trust_result_type = Security.SecTrustResultType()
|
|
476
|
+
Security.SecTrustEvaluate(sec_trust_ref, ctypes.byref(sec_trust_result_type))
|
|
477
|
+
|
|
478
|
+
try:
|
|
479
|
+
sec_trust_result_type_as_int = int(sec_trust_result_type.value)
|
|
480
|
+
except (ValueError, TypeError):
|
|
481
|
+
sec_trust_result_type_as_int = -1
|
|
482
|
+
|
|
483
|
+
# Apple doesn't document these values in their own API docs.
|
|
484
|
+
# See: https://github.com/xybp888/iOS-SDKs/blob/master/iPhoneOS13.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecTrust.h#L84
|
|
485
|
+
if (
|
|
486
|
+
ssl_context.verify_mode == ssl.CERT_REQUIRED
|
|
487
|
+
and sec_trust_result_type_as_int not in (1, 4)
|
|
488
|
+
):
|
|
489
|
+
# Note that we're not able to ignore only hostname errors
|
|
490
|
+
# for macOS 10.13 and earlier, so check_hostname=False will
|
|
491
|
+
# still return an error.
|
|
492
|
+
sec_trust_result_type_to_message = {
|
|
493
|
+
0: "Invalid trust result type",
|
|
494
|
+
# 1: "Trust evaluation succeeded",
|
|
495
|
+
2: "User confirmation required",
|
|
496
|
+
3: "User specified that certificate is not trusted",
|
|
497
|
+
# 4: "Trust result is unspecified",
|
|
498
|
+
5: "Recoverable trust failure occurred",
|
|
499
|
+
6: "Fatal trust failure occurred",
|
|
500
|
+
7: "Other error occurred, certificate may be revoked",
|
|
501
|
+
}
|
|
502
|
+
error_message = sec_trust_result_type_to_message.get(
|
|
503
|
+
sec_trust_result_type_as_int,
|
|
504
|
+
f"Unknown trust result: {sec_trust_result_type_as_int}",
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
err = ssl.SSLCertVerificationError(error_message)
|
|
508
|
+
err.verify_message = error_message
|
|
509
|
+
err.verify_code = sec_trust_result_type_as_int
|
|
510
|
+
raise err
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
def _verify_peercerts_impl_macos_10_14(
|
|
514
|
+
ssl_context: ssl.SSLContext, sec_trust_ref: typing.Any
|
|
515
|
+
) -> None:
|
|
516
|
+
"""Verify using 'SecTrustEvaluateWithError' API for macOS 10.14+."""
|
|
517
|
+
cf_error = CoreFoundation.CFErrorRef()
|
|
518
|
+
sec_trust_eval_result = Security.SecTrustEvaluateWithError(
|
|
519
|
+
sec_trust_ref, ctypes.byref(cf_error)
|
|
520
|
+
)
|
|
521
|
+
# sec_trust_eval_result is a bool (0 or 1)
|
|
522
|
+
# where 1 means that the certs are trusted.
|
|
523
|
+
if sec_trust_eval_result == 1:
|
|
524
|
+
is_trusted = True
|
|
525
|
+
elif sec_trust_eval_result == 0:
|
|
526
|
+
is_trusted = False
|
|
527
|
+
else:
|
|
528
|
+
raise ssl.SSLError(
|
|
529
|
+
f"Unknown result from Security.SecTrustEvaluateWithError: {sec_trust_eval_result!r}"
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
cf_error_code = 0
|
|
533
|
+
if not is_trusted:
|
|
534
|
+
cf_error_code = CoreFoundation.CFErrorGetCode(cf_error)
|
|
535
|
+
|
|
536
|
+
# If the error is a known failure that we're
|
|
537
|
+
# explicitly okay with from SSLContext configuration
|
|
538
|
+
# we can set is_trusted accordingly.
|
|
539
|
+
if ssl_context.verify_mode != ssl.CERT_REQUIRED and (
|
|
540
|
+
cf_error_code == CFConst.errSecNotTrusted
|
|
541
|
+
or cf_error_code == CFConst.errSecCertificateExpired
|
|
542
|
+
):
|
|
543
|
+
is_trusted = True
|
|
544
|
+
|
|
545
|
+
# If we're still not trusted then we start to
|
|
546
|
+
# construct and raise the SSLCertVerificationError.
|
|
547
|
+
if not is_trusted:
|
|
548
|
+
cf_error_string_ref = None
|
|
549
|
+
try:
|
|
550
|
+
cf_error_string_ref = CoreFoundation.CFErrorCopyDescription(cf_error)
|
|
551
|
+
|
|
552
|
+
# Can this ever return 'None' if there's a CFError?
|
|
553
|
+
cf_error_message = (
|
|
554
|
+
_cf_string_ref_to_str(cf_error_string_ref)
|
|
555
|
+
or "Certificate verification failed"
|
|
556
|
+
)
|
|
557
|
+
|
|
558
|
+
# TODO: Not sure if we need the SecTrustResultType for anything?
|
|
559
|
+
# We only care whether or not it's a success or failure for now.
|
|
560
|
+
sec_trust_result_type = Security.SecTrustResultType()
|
|
561
|
+
Security.SecTrustGetTrustResult(
|
|
562
|
+
sec_trust_ref, ctypes.byref(sec_trust_result_type)
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
err = ssl.SSLCertVerificationError(cf_error_message)
|
|
566
|
+
err.verify_message = cf_error_message
|
|
567
|
+
err.verify_code = cf_error_code
|
|
568
|
+
raise err
|
|
569
|
+
finally:
|
|
570
|
+
if cf_error_string_ref:
|
|
571
|
+
CoreFoundation.CFRelease(cf_error_string_ref)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
import ssl
|
|
5
|
+
import typing
|
|
6
|
+
|
|
7
|
+
# candidates based on https://github.com/tiran/certifi-system-store by Christian Heimes
|
|
8
|
+
_CA_FILE_CANDIDATES = [
|
|
9
|
+
# Alpine, Arch, Fedora 34+, OpenWRT, RHEL 9+, BSD
|
|
10
|
+
"/etc/ssl/cert.pem",
|
|
11
|
+
# Fedora <= 34, RHEL <= 9, CentOS <= 9
|
|
12
|
+
"/etc/pki/tls/cert.pem",
|
|
13
|
+
# Debian, Ubuntu (requires ca-certificates)
|
|
14
|
+
"/etc/ssl/certs/ca-certificates.crt",
|
|
15
|
+
# SUSE
|
|
16
|
+
"/etc/ssl/ca-bundle.pem",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
_HASHED_CERT_FILENAME_RE = re.compile(r"^[0-9a-fA-F]{8}\.[0-9]$")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@contextlib.contextmanager
|
|
23
|
+
def _configure_context(ctx: ssl.SSLContext) -> typing.Iterator[None]:
|
|
24
|
+
# First, check whether the default locations from OpenSSL
|
|
25
|
+
# seem like they will give us a usable set of CA certs.
|
|
26
|
+
# ssl.get_default_verify_paths already takes care of:
|
|
27
|
+
# - getting cafile from either the SSL_CERT_FILE env var
|
|
28
|
+
# or the path configured when OpenSSL was compiled,
|
|
29
|
+
# and verifying that that path exists
|
|
30
|
+
# - getting capath from either the SSL_CERT_DIR env var
|
|
31
|
+
# or the path configured when OpenSSL was compiled,
|
|
32
|
+
# and verifying that that path exists
|
|
33
|
+
# In addition we'll check whether capath appears to contain certs.
|
|
34
|
+
defaults = ssl.get_default_verify_paths()
|
|
35
|
+
if defaults.cafile or (defaults.capath and _capath_contains_certs(defaults.capath)):
|
|
36
|
+
ctx.set_default_verify_paths()
|
|
37
|
+
else:
|
|
38
|
+
# cafile from OpenSSL doesn't exist
|
|
39
|
+
# and capath from OpenSSL doesn't contain certs.
|
|
40
|
+
# Let's search other common locations instead.
|
|
41
|
+
for cafile in _CA_FILE_CANDIDATES:
|
|
42
|
+
if os.path.isfile(cafile):
|
|
43
|
+
ctx.load_verify_locations(cafile=cafile)
|
|
44
|
+
break
|
|
45
|
+
|
|
46
|
+
yield
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _capath_contains_certs(capath: str) -> bool:
|
|
50
|
+
"""Check whether capath exists and contains certs in the expected format."""
|
|
51
|
+
if not os.path.isdir(capath):
|
|
52
|
+
return False
|
|
53
|
+
for name in os.listdir(capath):
|
|
54
|
+
if _HASHED_CERT_FILENAME_RE.match(name):
|
|
55
|
+
return True
|
|
56
|
+
return False
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _verify_peercerts_impl(
|
|
60
|
+
ssl_context: ssl.SSLContext,
|
|
61
|
+
cert_chain: list[bytes],
|
|
62
|
+
server_hostname: str | None = None,
|
|
63
|
+
) -> None:
|
|
64
|
+
# This is a no-op because we've enabled SSLContext's built-in
|
|
65
|
+
# verification via verify_mode=CERT_REQUIRED, and don't need to repeat it.
|
|
66
|
+
pass
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import ssl
|
|
2
|
+
import sys
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
# Hold on to the original class so we can create it consistently
|
|
6
|
+
# even if we inject our own SSLContext into the ssl module.
|
|
7
|
+
_original_SSLContext = ssl.SSLContext
|
|
8
|
+
_original_super_SSLContext = super(_original_SSLContext, _original_SSLContext)
|
|
9
|
+
|
|
10
|
+
# CPython is known to be good, but non-CPython implementations
|
|
11
|
+
# may implement SSLContext differently so to be safe we don't
|
|
12
|
+
# subclass the SSLContext.
|
|
13
|
+
|
|
14
|
+
# This is returned by truststore.SSLContext.__class__()
|
|
15
|
+
_truststore_SSLContext_dunder_class: typing.Optional[type]
|
|
16
|
+
|
|
17
|
+
# This value is the superclass of truststore.SSLContext.
|
|
18
|
+
_truststore_SSLContext_super_class: type
|
|
19
|
+
|
|
20
|
+
if sys.implementation.name == "cpython":
|
|
21
|
+
_truststore_SSLContext_super_class = _original_SSLContext
|
|
22
|
+
_truststore_SSLContext_dunder_class = None
|
|
23
|
+
else:
|
|
24
|
+
_truststore_SSLContext_super_class = object
|
|
25
|
+
_truststore_SSLContext_dunder_class = _original_SSLContext
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _set_ssl_context_verify_mode(
|
|
29
|
+
ssl_context: ssl.SSLContext, verify_mode: ssl.VerifyMode
|
|
30
|
+
) -> None:
|
|
31
|
+
_original_super_SSLContext.verify_mode.__set__(ssl_context, verify_mode) # type: ignore[attr-defined]
|