mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-01 15:04:52 +00:00
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user