Browse Source

Fixed paste for unencrypted paste

tags/2.0.3
Teknikode 4 years ago
parent
commit
681086df3c
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      Teknik/Areas/Paste/Controllers/PasteController.cs

+ 3
- 1
Teknik/Areas/Paste/Controllers/PasteController.cs 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);

Loading…
Cancel
Save