exe File not released after AES Java encryption
I have a function that encrypts files using AES 256 ( Java lib ) and then delete by writing over the file. For some reason it does not work for .exe files. The file gets encrypted by the delete cannot be performed "Access Denied". I am guessing that somehow the file is not released during the encryption but can't seem to find a开发者_JAVA技巧 logical explanation since it works for all the other files.
I can think of two possible explanations:
The file is being executed, and the OS has locked it to prevent writes from interfering with the running process.
The file's access flags do not allow writing; i.e. it is read-only. This would not prevent a normal delete from working, because deletion does not necessarily require write access to the file. (Certainly it doesn't on UNIX / Linux ... where delete is treated as an operation on the parent directory, and is allowed / denied base on the directory's access flags.)
精彩评论