MarkItUp.SingleUserBlog/Common/SecurityHelper.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Web;
using System.Security.Cryptography;
using System.Text;
using MarkItUp.SingleUserBlog.Services;
using System.Xml;
using System.Collections.Generic;
namespace MarkItUp.SingleUserBlog.Common {
public class SecurityHelper {
private SecurityHelper() { }
public static bool CurrentUserIsBlogOwner {
get {
HttpContext ctx = HttpContext.Current;
if (!ctx.Request.IsAuthenticated)
return false;
return ctx.User.Identity.Name == Globals.UserLoginName;
}
}
static TripleDESCryptoServiceProvider _crypto = new TripleDESCryptoServiceProvider();
static byte[] _tdeskey = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 };
static byte[] _IV = { 1, 2, 3, 4, 5, 6, 7, 8 };
public static string EncryptData(string data) {
string encryptedData = "";
if (data != null && data.Length > 0) {
byte[] receivedBytes = Encoding.Unicode.GetBytes(data);
byte[] encryptedBytes =
_crypto.CreateEncryptor(_tdeskey, _IV).TransformFinalBlock(
receivedBytes,
0,
receivedBytes.GetLength(0)
);
encryptedData = Convert.ToBase64String(encryptedBytes);
}
return encryptedData;
}
public static string DecryptData(string encryptedData) {
string decryptedData = "";
if (encryptedData != null && encryptedData.Length > 0) {
byte[] base64 = Convert.FromBase64String(encryptedData);
byte[] bytes = _crypto.CreateDecryptor(_tdeskey, _IV).TransformFinalBlock(
base64,
0,
base64.GetLength(0)
);
后面还有 41 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
