From c681a2997f4654a97851b8690c42430da2e6f407 Mon Sep 17 00:00:00 2001
From: nilaoda <nilaoda@live.com>
Date: Sat, 17 Sep 2022 10:19:57 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E8=87=AA=E5=AE=9A=E4=B9=89KE?=
 =?UTF-8?q?Y/IV?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Processor/HLS/DefaultHLSKeyProcessor.cs            | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/N_m3u8DL-RE.Parser/Processor/HLS/DefaultHLSKeyProcessor.cs b/src/N_m3u8DL-RE.Parser/Processor/HLS/DefaultHLSKeyProcessor.cs
index e3f8c8d..128b5b8 100644
--- a/src/N_m3u8DL-RE.Parser/Processor/HLS/DefaultHLSKeyProcessor.cs
+++ b/src/N_m3u8DL-RE.Parser/Processor/HLS/DefaultHLSKeyProcessor.cs
@@ -32,11 +32,19 @@ namespace N_m3u8DL_RE.Parser.Processor.HLS
             {
                 encryptInfo.IV = HexUtil.HexToBytes(iv);
             }
+            if (parserConfig.CustomeIV != null)
+            {
+                encryptInfo.IV = parserConfig.CustomeIV;
+            }
 
             //KEY
             try
             {
-                if (uri.ToLower().StartsWith("base64:"))
+                if (parserConfig.CustomeKey != null)
+                {
+                    encryptInfo.Key = parserConfig.CustomeKey;
+                }
+                else if (uri.ToLower().StartsWith("base64:"))
                 {
                     encryptInfo.Key = Convert.FromBase64String(uri[7..]);
                 }