gpt4 book ai didi

cocoa - 如何写回现有文件,确保磁盘上的位在 OS X 中被覆盖

转载 作者:行者123 更新时间:2023-12-03 16:51:59 24 4
gpt4 key购买 nike

我可以使用 Cocoa 或 Core Foundation 的什么 API 来确保当我写回存储设备上已存在的文件时,这些位会被覆盖?这个想法是出于安全原因清除这些位。

最佳答案

在现代文件系统中,无法保证您覆盖磁盘上的相同物理位置 - 缺乏这种保证允许文件系统为您提供更好的性能。您可能有兴趣阅读this paper (PDF) ,适当的标题为什么安全删除不起作用并且任何敏感数据都不应该以未加密的方式存储在磁盘上(强调我的)。

另请考虑来自 the shred manpage 的警告:

CAUTION: Note that shred relies on a very important assumption: that the file system overwrites data in place. This is the traditional way to do things, but many modern file system designs do not satisfy this assumption. The following are examples of file systems on which shred is not effective, or is not guaranteed to be effective in all file system modes:

  • log-structured or journaled file systems, such as those supplied with AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)

  • file systems that write redundant data and carry on even if some writes fail, such as RAID-based file systems

  • file systems that make snapshots, such as Network Appliance's NFS server

  • file systems that cache in temporary locations, such as NFS version 3 clients

  • compressed file systems

话虽这么说,Cocoa 或 Core Foundation 中可能有某种方式允许您写入特定的磁头/柱面/扇区/等。在磁盘上 —— 我对这些 API 不太熟悉 —— 但我非常怀疑。

关于cocoa - 如何写回现有文件,确保磁盘上的位在 OS X 中被覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1529182/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com