想知道文件夹加密的原理 我想用C#来实现加密文件和文件夹.有没有人知道加这个原理??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我前面刚做查了一个 public static string Encrypt(string pToEncrypt, string sKey) { using (DESCryptoServiceProvider des = new DESCryptoServiceProvider()) { byte[] inputByteArray = Encoding.UTF8.GetBytes(pToEncrypt); des.Key = ASCIIEncoding.ASCII.GetBytes(sKey); des.IV = ASCIIEncoding.ASCII.GetBytes(sKey); System.IO.MemoryStream ms = new System.IO.MemoryStream(); using (CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write)) { cs.Write(inputByteArray, 0, inputByteArray.Length); cs.FlushFinalBlock(); cs.Close(); } string str = Convert.ToBase64String(ms.ToArray()); ms.Close(); return str; } } public static string Decrypt(string pToDecrypt, string sKey) { byte[] inputByteArray = Convert.FromBase64String(pToDecrypt); using (DESCryptoServiceProvider des = new DESCryptoServiceProvider()) { des.Key = ASCIIEncoding.ASCII.GetBytes(sKey); des.IV = ASCIIEncoding.ASCII.GetBytes(sKey); System.IO.MemoryStream ms = new System.IO.MemoryStream(); using (CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write)) { cs.Write(inputByteArray, 0, inputByteArray.Length); cs.FlushFinalBlock(); cs.Close(); } string str = Encoding.UTF8.GetString(ms.ToArray()); ms.Close(); return str; } } 1.利用windows系统特殊的保留文件名后缀,使文件夹无法打开和删除。 例如类似com1.{21ec2020-3aea-1069-a2dd-08002b30309d}等文件夹名称。 2.利用回收站特点,将文件夹保存在回收站,然后创建创建名为recycle或者RECYCLED的伪回收站。 3.直接将系统—文件夹的对应关系破坏, 在系统中留下一个没有文件实际地址的文件目录, 而在加密软件中则保存该文件夹的实际地址。 4、通过系统驻留程序监控被加密的文件夹,如果需打开,则提示输入密码,而实际上并没有对文件进行加密。 C# treeview获取选中节点的值 c# office的问题 算法讨论,希望大家参与 好像.NET不支持INI文件了。 关于散列算法和icryptotransform接口 类中的静态字段的使用问题 郁闷郁闷。。。。。。。 调试时无法运行,output框里出现这样一段,帮忙啊!! C# 怎么抓到AutoIt Window Info 取得的Instance值 C语言代码翻译成C# C#中无法找到Form2 ---------怎样可以动态刷新数据库呢谢谢
{
using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
{
byte[] inputByteArray = Encoding.UTF8.GetBytes(pToEncrypt);
des.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
des.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
using (CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write))
{
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
cs.Close();
}
string str = Convert.ToBase64String(ms.ToArray());
ms.Close();
return str;
}
} public static string Decrypt(string pToDecrypt, string sKey)
{
byte[] inputByteArray = Convert.FromBase64String(pToDecrypt);
using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
{
des.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
des.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
using (CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write))
{
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
cs.Close();
}
string str = Encoding.UTF8.GetString(ms.ToArray());
ms.Close();
return str;
}
}
例如类似com1.{21ec2020-3aea-1069-a2dd-08002b30309d}等文件夹名称。 2.利用回收站特点,将文件夹保存在回收站,然后创建创建名为recycle或者RECYCLED的伪回收站。 3.直接将系统—文件夹的对应关系破坏,
在系统中留下一个没有文件实际地址的文件目录,
而在加密软件中则保存该文件夹的实际地址。 4、通过系统驻留程序监控被加密的文件夹,如果需打开,则提示输入密码,而实际上并没有对文件进行加密。