aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/aes.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2022-02-05 10:48:13 -0500
committerJesús <heckyel@hyperbola.info>2022-02-05 10:48:13 -0500
commitc4b763b19f54ed5dfc2fd408adb9ed74126f6740 (patch)
tree1bbf4450644370608f97bf6d4d7db818c5039f55 /yt_dlp/aes.py
parent5aac4e0267e32d98eb68692afedafda3b41ea629 (diff)
parenta3125791c7a5cdf2c8c025b99788bf686edd1a8a (diff)
downloadhypervideo-pre-c4b763b19f54ed5dfc2fd408adb9ed74126f6740.tar.lz
hypervideo-pre-c4b763b19f54ed5dfc2fd408adb9ed74126f6740.tar.xz
hypervideo-pre-c4b763b19f54ed5dfc2fd408adb9ed74126f6740.zip
updated from upstream | 05/02/2022 at 10:48
Diffstat (limited to 'yt_dlp/aes.py')
-rw-r--r--yt_dlp/aes.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/yt_dlp/aes.py b/yt_dlp/aes.py
index 8503e3dfd..b37f0dd39 100644
--- a/yt_dlp/aes.py
+++ b/yt_dlp/aes.py
@@ -2,8 +2,15 @@ from __future__ import unicode_literals
from math import ceil
-from .compat import compat_b64decode, compat_pycrypto_AES
-from .utils import bytes_to_intlist, intlist_to_bytes
+from .compat import (
+ compat_b64decode,
+ compat_ord,
+ compat_pycrypto_AES,
+)
+from .utils import (
+ bytes_to_intlist,
+ intlist_to_bytes,
+)
if compat_pycrypto_AES:
@@ -25,6 +32,10 @@ else:
return intlist_to_bytes(aes_gcm_decrypt_and_verify(*map(bytes_to_intlist, (data, key, tag, nonce))))
+def unpad_pkcs7(data):
+ return data[:-compat_ord(data[-1])]
+
+
BLOCK_SIZE_BYTES = 16
@@ -506,5 +517,6 @@ __all__ = [
'aes_encrypt',
'aes_gcm_decrypt_and_verify',
'aes_gcm_decrypt_and_verify_bytes',
- 'key_expansion'
+ 'key_expansion',
+ 'unpad_pkcs7',
]