diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index 1d83118a2..8cedd7b26 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -156,6 +156,8 @@ namespace NzbDrone.Core.Configuration public string HmacSalt => GetValue("HmacSalt", Guid.NewGuid().ToString(), true); + public string DownloadProtectionKey => GetValue("DownloadProtectionKey", Guid.NewGuid().ToString().Replace("-", ""), true); + public bool ProxyEnabled => GetValueBoolean("ProxyEnabled", false); public ProxyType ProxyType => GetValueEnum("ProxyType", ProxyType.Http); diff --git a/src/NzbDrone.Core/Configuration/IConfigService.cs b/src/NzbDrone.Core/Configuration/IConfigService.cs index fb330e41e..8da617821 100644 --- a/src/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -33,6 +33,9 @@ namespace NzbDrone.Core.Configuration string RijndaelSalt { get; } string HmacSalt { get; } + //Link Protection + string DownloadProtectionKey { get; } + //Proxy bool ProxyEnabled { get; } ProxyType ProxyType { get; } diff --git a/src/NzbDrone.Core/Security/ProtectionService.cs b/src/NzbDrone.Core/Security/ProtectionService.cs index 196f028c2..dc9c468c9 100644 --- a/src/NzbDrone.Core/Security/ProtectionService.cs +++ b/src/NzbDrone.Core/Security/ProtectionService.cs @@ -15,16 +15,16 @@ namespace NzbDrone.Core.Security public class ProtectionService : IProtectionService { - private readonly IConfigFileProvider _configService; + private readonly IConfigService _configService; - public ProtectionService(IConfigFileProvider configService) + public ProtectionService(IConfigService configService) { _configService = configService; } public string Protect(string text) { - var key = Encoding.UTF8.GetBytes(_configService.ApiKey); + var key = Encoding.UTF8.GetBytes(_configService.DownloadProtectionKey); using (var aesAlg = Aes.Create()) { @@ -70,7 +70,7 @@ namespace NzbDrone.Core.Security Buffer.BlockCopy(fullCipher, 0, iv, 0, iv.Length); Buffer.BlockCopy(fullCipher, iv.Length, cipher, 0, fullCipher.Length - iv.Length); - var key = Encoding.UTF8.GetBytes(_configService.ApiKey); + var key = Encoding.UTF8.GetBytes(_configService.DownloadProtectionKey); using (var aesAlg = Aes.Create()) {