Fixed: Use separate guid for download protection

Fixes #963
pull/991/head
Qstick 2 years ago
parent bc50fd937d
commit 6783514525

@ -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", ProxyType.Http);

@ -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; }

@ -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())
{

Loading…
Cancel
Save