开发者

Where can I put temporary files that I don't want show to the user?

开发者 https://www.devze.com 2023-01-18 10:50 出处:网络
in my Mac software I need decrypt a file and, after I do my operations on it, I will remove it. My problem开发者_JAVA技巧 is: Where can I put this file? I don\'t want show it to the user.The following

in my Mac software I need decrypt a file and, after I do my operations on it, I will remove it. My problem开发者_JAVA技巧 is: Where can I put this file? I don't want show it to the user.


The following API will give you a directory path that is "out of the way":

NSTemporaryDirectory();

Do you mean "decrypt a file in a place the user can't access?" Any place your app can write to, the user can see. And in theory, a user can access any bit or byte on a computer to which they have physical access.

There are obfuscations and such that reduce the odds a user will come across sensitive data, but they are meant for particular situations.

Can you tell us more about your end goal here? Are you trying to implement a DRM/copy protection scheme? Are you trying to prevent cheating in a game? Do you just not trust your user? What?


I think your best bet would be to keep it in memory.

If that's not an option, it depends on what you want to do with it. It's possible you can open a temporary file, and immediately delete it - keeping the valid filehandle open, but not keeping a link to it on the disk.

Another option, perhaps - can you get your secondary program to read from STDIN or a pipe? You could then decrypt the file and pass it's content via a pipe? Clearly, the more complex this process is, the more weak links it might have, but sometimes you just have to get things working.

0

精彩评论

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