瀏覽代碼

Fixed paste for unencrypted paste

tags/2.0.2
Teknikode 5 年之前
父節點
當前提交
681086df3c
共有 1 個檔案被更改,包括 3 行新增1 行删除
  1. 3
    1
      Teknik/Areas/Paste/Controllers/PasteController.cs

+ 3
- 1
Teknik/Areas/Paste/Controllers/PasteController.cs 查看文件

@@ -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…
取消
儲存