1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Fixed paste for unencrypted paste

This commit is contained in:
Uncled1023 2016-02-03 15:10:03 -08:00
parent 7b71a4bb5c
commit 681086df3c

View File

@ -54,7 +54,7 @@ namespace Teknik.Areas.Paste.Controllers
model.Syntax = paste.Syntax;
model.DatePosted = paste.DatePosted;
byte[] data = Convert.FromBase64String(paste.Content);
byte[] data = Encoding.UTF8.GetBytes(paste.Content);
// The paste has a password set
if (!string.IsNullOrEmpty(paste.HashedPassword))
@ -67,6 +67,8 @@ namespace Teknik.Areas.Paste.Controllers
// Redirect them to the password request page
return View("~/Areas/Paste/Views/Paste/PasswordNeeded.cshtml", passModel);
}
data = Convert.FromBase64String(paste.Content);
// Now we decrypt the content
byte[] ivBytes = Encoding.Unicode.GetBytes(paste.IV);
byte[] keyBytes = AES.CreateKey(password, ivBytes, paste.KeySize);