Jam*_*mes 4 .net c# encryption obfuscation cryptography
此加密类是否足够安全?或者有人可以反汇编我的二进制文件来找到密钥和IV吗?我正在使用它来解密许可证文件,因此它不容易被破坏是非常重要的.
internal static class Encryptor
{
// Actual values are put here in my source
private static readonly byte[] Key = { 0, 0, 0, 0, 0, 0, 0, 0 };
private static readonly byte[] Iv = { 0, 0, 0, 0, 0, 0, 0, 0 };
internal static String Encrypt(string source)
{
var des = new DESCryptoServiceProvider();
var enc = des.CreateEncryptor(Key, Iv);
var b = Encoding.ASCII.GetBytes(source);
var encId = enc.TransformFinalBlock(b, 0, b.Length);
return Convert.ToBase64String(encId);
}
internal static string Decrypt(string encrypted)
{
var des = new DESCryptoServiceProvider();
var dec = des.CreateDecryptor(Key, Iv);
var b = Convert.FromBase64String(encrypted);
var decId = dec.TransformFinalBlock(b, 0, b.Length);
return Encoding.ASCII.GetString(decId);
}
}
Run Code Online (Sandbox Code Playgroud)
是的,这很容易被打破.任何具有Reflector(或ILSpy,或dotPeek,或......)等工具知识的开发人员都可以轻松识别加密功能并找到密钥.拥有程序集的人甚至可以Decrypt直接打电话,而不需要解除密钥.
它足够安全吗?这取决于,只有你能回答这个问题.如果这是用于许可,则相当于在盒子上贴上"不要复制我的软件".另一方面,为经验丰富且坚定的攻击者制定一个难以破解的强大许可方案是一项艰巨的任务,您可能需要考虑是否值得付出努力.就个人而言,我会花时间让软件变得如此棒,以至于人们会想要付出代价,而不是阻止少数坏人无法使用它.
| 归档时间: |
|
| 查看次数: |
4721 次 |
| 最近记录: |