Board index » cppbuilder » Protect files from opening

Protect files from opening


2007-10-29 12:17:38 AM
cppbuilder14
Hello
I have an app which download and create some graphic files (.jpg,.gif etc)
to the local disk of the user. Is there any way to prevent opening files
manually by user. changing extension or something.
Regards
SA
 
 

Re:Protect files from opening

Quote
Is there any way to prevent opening files manually by user. changing
extension or something.
That's one way. You would have to have some naming scheme so that your
program knows the correct file format when loading back in. For example,
drop the first letter, reverse the letter ordering, etc. ie. "_if" or "fig"
for "gif"
That solves the problem of double-click loading but a person could still
rename the file and load. To protect against that you could
encrypt/encode/compress the files before writing them to disk.
However, unless the images are of sensitive nature going through the hassle
usually isn't worth it.
Clayton
 

Re:Protect files from opening

"bar" < XXXX@XXXXX.COM >wrote in message
Quote
I have an app which download and create some graphic files
(.jpg,.gif etc) to the local disk of the user. Is there any way to
prevent opening files manually by user. changing extension or
something.
Even if you changed the file extension, the user can still specify the new
filename in any "File Open" dialog outside of your application.
You could try compressing the files into an archive file, such as a .zip
file, and then password-protect it. Or encrypt the files during downloading
and then decrypt them whenever your app needs to use them.
What exactly are you trying to prevent?
Gambit
 

{smallsort}

Re:Protect files from opening

Quote
What exactly are you trying to prevent?
I want to prevent file from editing.
Thanks
SA
 

Re:Protect files from opening

"bar" < XXXX@XXXXX.COM >wrote in message
Quote
I want to prevent file from editing.
Then you will have to either:
1) encrypt the file, like I suggested earlier
2) open the file for exclusive access at the time you download it. This
will only work while the downloading app is running, though. Once the file
is closed, the user can access it.
3) lock the file contents via LockFile/Ex(). Again, this only works until
the file is closed.
4) change the permissions on the file after downloading it (which will
likely require the downloading app to have admin rights) so the user can't
access the file at all. This introduces a timing issue, though, since the
user could get to the file before the app can update it.
Gambit
 

Re:Protect files from opening

Wouldn't ACL be able to lock it from access by other users?
. Ed
Quote
Remy Lebeau wrote in message news:4728d30e$ XXXX@XXXXX.COM ...

>I want to prevent file from editing.

Then you will have to either:

1) encrypt the file, like I suggested earlier

2) open the file for exclusive access at the time you download it. This
will only work while the downloading app is running, though. Once the
file is closed, the user can access it.

3) lock the file contents via LockFile/Ex(). Again, this only works until
the file is closed.

4) change the permissions on the file after downloading it (which will
likely require the downloading app to have admin rights) so the user can't
access the file at all. This introduces a timing issue, though, since the
user could get to the file before the app can update it.
 

Re:Protect files from opening

Hi Remy
Thanks for reply.
Is there any way to do this.
I have a folder "Test" say in C:\Windows\Temp\Test where i have some images.
Either my appliation is running or not. can i prevent the user without
opening this folder or accessing this folder.
SA
 

Re:Protect files from opening

I have a similar requirement but for text data files, that need to be non
user editable.
Ie Binary. Does anyone still use binary file formats? Last time I looked at
that was dos days, and using Turbo Basic.
"bar" < XXXX@XXXXX.COM >wrote in message
Quote
Hi Remy
Thanks for reply.

Is there any way to do this.
I have a folder "Test" say in C:\Windows\Temp\Test where i have some
images.

Either my appliation is running or not. can i prevent the user without
opening this folder or accessing this folder.

SA


 

Re:Protect files from opening

"Barry" < XXXX@XXXXX.COM >writes:
Quote
I have a similar requirement but for text data files, that need to
be non user editable.

Ie Binary. Does anyone still use binary file formats? Last time I
looked at that was dos days, and using Turbo Basic.
Sorry to say, but binary files are user-editable as well, though
somewhat less convenient.
The usual way to prevent access to a file is through file permissions,
which is pretty much outside of C++, and now into OS features.
--
Chris (TeamB);
 

Re:Protect files from opening

Hello,
Have you evaluate that files could be corrupted and just have to test
them by CRC computing ?
 

Re:Protect files from opening

Chris Uzdavinis (TeamB) wrote:
Quote
"Barry" < XXXX@XXXXX.COM >writes:

>I have a similar requirement but for text data files, that need to
>be non user editable.
>
>Ie Binary. Does anyone still use binary file formats? Last time I
>looked at that was dos days, and using Turbo Basic.

Sorry to say, but binary files are user-editable as well, though
somewhat less convenient.

The usual way to prevent access to a file is through file permissions,
which is pretty much outside of C++, and now into OS features.

OK, I can accept that binary format is editible, but not by a less
experienced person. I personally don't have a requirement to hide the
file contents, but the controlling authority responsible for approval of
the software now requires certain input data to be hidden from the user,
or not readily editable.
Would you recommend binary, or file permissions. I guess file
permissions could be easier, in that I don't have to change my code, but
can one ship a file, say via email, that has a built in permission. I
doubt it. It is something that has to be set up on each computer on
which it is installed....right?