安全删除C#.NET中的文件 [英] Securely deleting a file in C#.NET

查看:78
本文介绍了安全删除C#.NET中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个我正在做的项目中,我希望为用户提供安全删除文件的选项-例如,用随机位或0覆盖它。在C#.NET中是否有一种简便的方法?

In a project I am doing I want to give users the option of 'securely' deleting a file - as in, overwriting it with random bits or 0's. Is there an easy-ish way of doing this in C#.NET? And how effective would it be?

推荐答案

您可以调用 sysinternals SDelete 为您执行此操作。

You could invoke sysinternals SDelete to do this for you. This uses the defragmentation API to handle all those tricky edge cases.


使用碎片整理API,SDelete
可以精确地确定哪些集群磁盘上的
被属于压缩,稀疏和
加密文件的数据
占用。

Using the defragmentation API, SDelete can determine precisely which clusters on a disk are occupied by data belonging to compressed, sparse and encrypted files.

如果您想以更方便的形式重新打包该逻辑,请在此处

If you want to repackage that logic in a more convenient form, the API is described here.

这篇关于安全删除C#.NET中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆