Browse Source

Fixed pastes erroring out if there is no IV/Key

pull/111/head
Teknikode 3 years ago
parent
commit
73e5e084a5
  1. 4
      Teknik/Areas/Paste/Controllers/PasteController.cs

4
Teknik/Areas/Paste/Controllers/PasteController.cs

@ -76,8 +76,8 @@ namespace Teknik.Areas.Paste.Controllers @@ -76,8 +76,8 @@ namespace Teknik.Areas.Paste.Controllers
}
}
byte[] ivBytes = Encoding.Unicode.GetBytes(paste.IV);
byte[] keyBytes = AesCounterManaged.CreateKey(paste.Key, ivBytes, paste.KeySize);
byte[] ivBytes = (string.IsNullOrEmpty(paste.IV)) ? new byte[paste.BlockSize] : Encoding.Unicode.GetBytes(paste.IV);
byte[] keyBytes = (string.IsNullOrEmpty(paste.Key)) ? new byte[paste.KeySize] : AesCounterManaged.CreateKey(paste.Key, ivBytes, paste.KeySize);
// The paste has a password set
if (!string.IsNullOrEmpty(paste.HashedPassword))

Loading…
Cancel
Save