diff options
author | coletdev <coletdjnz@protonmail.com> | 2022-05-02 19:59:45 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 07:59:45 +0000 |
commit | bb58c9ed5c3121bf55edcac9af8d62f5143b89d8 (patch) | |
tree | f7a4f792529513c6892c66b86840c39fc02a1429 /yt_dlp/utils.py | |
parent | afac4caa7db30804bebac33e53c3cb0237958224 (diff) | |
download | hypervideo-pre-bb58c9ed5c3121bf55edcac9af8d62f5143b89d8.tar.lz hypervideo-pre-bb58c9ed5c3121bf55edcac9af8d62f5143b89d8.tar.xz hypervideo-pre-bb58c9ed5c3121bf55edcac9af8d62f5143b89d8.zip |
Add support for SSL client certificate authentication (#3435)
Adds `--client-certificate`, `--client-certificate-key`, `--client-certificate-password`
Authored-by: coletdjnz
Co-authored-by: df <fieldhouse@gmx.net>
Co-authored-by: pukkandan <pukkandan.ytdlp@gmail.com>
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r-- | yt_dlp/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 5c83b92b4..3f22eaf75 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -936,6 +936,14 @@ def make_HTTPS_handler(params, **kwargs): for storename in ('CA', 'ROOT'): _ssl_load_windows_store_certs(context, storename) context.set_default_verify_paths() + client_certfile = params.get('client_certificate') + if client_certfile: + try: + context.load_cert_chain( + client_certfile, keyfile=params.get('client_certificate_key'), + password=params.get('client_certificate_password')) + except ssl.SSLError: + raise YoutubeDLError('Unable to load client certificate') return YoutubeDLHTTPSHandler(params, context=context, **kwargs) |