7 Replies - 762 Views - Last Post: 26 October 2016 - 07:22 PM Rate Topic: -----

#1 viktor80  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 97
  • Joined: 25-April 16

How to make text doc available to read/write only through the app

Posted 19 October 2016 - 11:12 PM

Hello

I'm still trying to figure out, how to make text document available to read and write only through the application. Document contains personal data, which is updated and processed by the user. It is created through the program and saved in the program folder, and is removed with uninstall, but during the using, it should not be available directly through the folder. In some way necessary to make it closed or invisible, maybe unreadable. But I have no idea, which kind of obfuscation or encrypting I have to research, what is suitable for text document text, or what is a better for this case, how to do it. Data should not be damaged or changed of course. Or perhaps in this case it is better to use something completely different? Contents should not be changed, and the file can not be removed, it must be protected from any external action. It is available for user with own password, and another user has it own file which is available with another password on the same computer. I think about sending it to the server, but what should be taken into account, read/write must be fast, it makes request and gets response from it, this process must not be slowed, but I never have deal with such things, would be good to get some useful information. You can open, copy it through the interface, but it must be closed for any external touching. Also System.Security.Cryptography .NET class library, but not sure if it is right way. Maybe own specific extension except .txt, but it can be opened just with word pad, also I'm not sure then how to open own extension, because user must be able to do it through interface.

Is This A Good Question/Topic? 0
  • +

Replies To: How to make text doc available to read/write only through the app

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5947
  • View blog
  • Posts: 20,385
  • Joined: 05-May 12

Re: How to make text doc available to read/write only through the app

Posted 20 October 2016 - 05:51 AM

You have conflicting requirements. You say that you want the document readable only by your program, but at the same time you want it readable with notepad. You can't have both.
Was This Post Helpful? 0
  • +
  • -

#3 viktor80  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 97
  • Joined: 25-April 16

Re: How to make text doc available to read/write only through the app

Posted 20 October 2016 - 04:53 PM

Hello, no I mean to change extension for text document as variant to make it not available have no sense because you can just open with notepad, something like document.myext except .txt and then how to open it through the file, because in this case program opens it same way as user. only difference is that user have personal password to option to open the file, and also externally there is no differences between document of one user with password to option to open it, and document of another user with other password, so I mean, it is bad idea on each point, if I can read it with one click, maybe, it will probably not hard to do for even the most inexperienced computer user
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5947
  • View blog
  • Posts: 20,385
  • Joined: 05-May 12

Re: How to make text doc available to read/write only through the app

Posted 20 October 2016 - 09:34 PM

I'm sorry. I don't understand your giant run-on sentence with minimal capitalization and only one obvious period in there. I thought that your original post was bad. That response was worse.

Please list all your requirements as a numbered list. Use proper punctuation and capitalization.

Anyway, from what I can understand you don't want other users to have access to each others files. In general, each user gets their own private area under their user profile directory under C:\Users. It's typically only users who have admin right who can go visit all the users folders (albeit, by override security). For this to work, though, you'll have to give up the notion of saving the files in the same directory as your program. Any which way, you should give up that idea anyway since users will typically not have write access to the C:\Program Files tree, so it makes sense to write files into their individual "My Documents" or folders anyway.

Registering file extension handlers is easy. Simply search MSDN.

Your thought of not letting anything else touch or manipulate your files is a pipe dream if you plan on doing everything in managed code. The only way to virtually stealth the files to everything else running on the machine except for your program is to create a device driver. Definitely not something for the faint of heart, and not something easily accomplished using managed code. In other words, give up on this idea as well.

Yes, encryption is the recommended way to protect data from prying eyes.
Was This Post Helpful? 0
  • +
  • -

#5 viktor80  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 97
  • Joined: 25-April 16

Re: How to make text doc available to read/write only through the app

Posted 24 October 2016 - 08:23 AM

Hello, thanks for the answer.

Yes I'm sorry for that, but as I was warned not to change post after a certain time, and especially if there is an answer, I did not touch it.

Exactly I don't want users to have access to each others files on same computer with same program. For that only thing I lack is to make text document not available externally in folder.

View PostSkydiver, on 20 October 2016 - 09:34 PM, said:

For this to work, though, you'll have to give up the notion of saving the files in the same directory as your program. Any which way, you should give up that idea anyway since users will typically not have write access to the C:\Program Files tree, so it makes sense to write files into their individual "My Documents" or folders anyway.


at this stage I store files this way %ProgramData% for executable. Need some guide on this direction, since I have no such practice about writing into individual "My Documents" and keep directory path in working condition for executable.

Also I'm wondering, maybe I can send file to server, but I'm not sure, in terms of the speed of request and answer, because the user is constantly drawn to their data. Need some guide on this practice.

and:

View PostSkydiver, on 20 October 2016 - 09:34 PM, said:

Registering file extension handlers is easy. Simply search MSDN.


Does that make sense, except to read the file from the program?

So if encryption is the best way to protect data, I have to do it so that it works only when I try to open a file directly in folder, but at same time make it accessible from inside
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13655
  • View blog
  • Posts: 54,483
  • Joined: 12-June 08

Re: How to make text doc available to read/write only through the app

Posted 24 October 2016 - 08:29 AM

I would look at the 'environment's namespace for 'special folder'. My Documents is in there.

https://msdn.microso...(v=vs.110).aspx
Was This Post Helpful? 1
  • +
  • -

#7 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5947
  • View blog
  • Posts: 20,385
  • Joined: 05-May 12

Re: How to make text doc available to read/write only through the app

Posted 24 October 2016 - 09:08 AM

View Postviktor80, on 24 October 2016 - 11:23 AM, said:

Yes I'm sorry for that, but as I was warned not to change post after a certain time, and especially if there is an answer, I did not touch it.


We were warning you about going back and editing your old posts. Doing so is bad because it changes the context of the original responses to the post prior to your edit. For example if you ask color is the sky in post #25, and somebody responds with blue in post #26, and then you go back and change your post in #25 to ask what is the color of the White House, then the entire thread sequence of questions and answers looks very odd to somebody coming into the forum a month later and stumbles across the thread.

Additionally, we also warned you about unnecessarily bumping a thread when you were not getting responses within an hour or two of your posting.
Was This Post Helpful? 0
  • +
  • -

#8 viktor80  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 97
  • Joined: 25-April 16

Re: How to make text doc available to read/write only through the app

Posted 26 October 2016 - 07:22 PM

ok, all is clear. Thank you for the clarification
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1