开发者

Prevent Cocoa app from using virtual memory, or at least securely clear it after usage

How can I prevent my Cocoa app from using any virtual memory, or if that is not possible, securely clear the virtual memory contents (on the hard drive) after usage?

I'm worried about such things, because let's say I'm creating an app like 1Password that stores passwords. And let's say, while the passwords are temporarily shown to the user and read from memory, what if virtual memory is needed? Then I run the risk of having the actual passwords exposed on the hard drive for intruders to look at!

Another example would be encryption software. A file is put in, and encrypted file is put out. If virtual memory is needed, the unencrypted file contents may be exposed on hard drive. This is very bad, because the user would expect only the original file itself to be exposed. The user would not expect the file contents to lay exposed on the hard drive because of virtual memory usag开发者_运维技巧e! In fact, the user shouldn't have to worry about such things.


Apple provides a system level feature that solves this problem called Secure Virtual Memory that's on by default on newer Macs (I think Snow Leopard onwards). You can turn it on and off from Security pane of System Preferences.

As far as I know, there's no easy way to do this at the application level, although you could certainly encourage your users to enable it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜