초기 커밋.

This commit is contained in:
2025-12-17 12:40:51 +09:00
parent e8d195c03e
commit 368acb1aa8
184 changed files with 95393 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace LFP_Manager.Function
{
class CsCryptoHelper
{
// 고정 키 및 IV (보안상 실제 사용 시 안전하게 관리 필요)
private static readonly string key = "1234567890123456"; // 16글자 = 128bit
private static readonly string iv = "6543210987654321"; // 16글자 = 128bit
public static string Encrypt(string plainText)
{
using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = Encoding.UTF8.GetBytes(key);
aesAlg.IV = Encoding.UTF8.GetBytes(iv);
ICryptoTransform encryptor = aesAlg.CreateEncryptor();
using (MemoryStream msEncrypt = new MemoryStream())
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
{
swEncrypt.Write(plainText);
swEncrypt.Close();
return Convert.ToBase64String(msEncrypt.ToArray());
}
}
}
public static string Decrypt(string cipherText)
{
using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = Encoding.UTF8.GetBytes(key);
aesAlg.IV = Encoding.UTF8.GetBytes(iv);
ICryptoTransform decryptor = aesAlg.CreateDecryptor();
byte[] buffer = Convert.FromBase64String(cipherText);
using (MemoryStream msDecrypt = new MemoryStream(buffer))
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
using (StreamReader srDecrypt = new StreamReader(csDecrypt))
{
return srDecrypt.ReadToEnd();
}
}
}
}
}