CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2010
    Posts
    139

    is it possible for a file with a customised extension to be non-readable to other app

    i have created a file association by creating my own file extension. i have registered the new file extension to a particular application. i then opened notepad and put in a few sentences i and saved the file with my new file extension. when i click the file my program opens which is what i want to happen. however if i go through notepad or word and click open files and click the filename with the new extension the file opens and is readable, why is that?

    i want it to be unreadable in other applications just like pdf files can't be read in word or notepad is what i want for my file extension. is this possible?

    another problem is, my program is a login application, so the user has to log in to see and read the file, however when the user enters the correct info the file does not show. is there something i'm missing? am i required to write code in my program too? if so what?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: is it possible for a file with a customised extension to be non-readable to other

    Quote Originally Posted by katy_price View Post
    ... if i go through notepad or word and click open files and click the filename with the new extension the file opens and is readable, why is that?
    Why not?
    It is how file system is designed!

    Quote Originally Posted by katy_price View Post
    ... i want it to be unreadable in other applications just like pdf files can't be read in word or notepad is what i want for my file extension. is this possible?
    No, it is not possible.
    Besides, no one (and nothing) forbids any other (not registered) application to read word or .pdf or any other file (the only problem for the application reading this file is to read and interpret it properly)

    Quote Originally Posted by katy_price View Post
    another problem is, my program is a login application, so the user has to log in to see and read the file, however when the user enters the correct info the file does not show. is there something i'm missing? am i required to write code in my program too? if so what?
    Perhaps, you should work with the user writes/permissions to read your files. not the file extensions?
    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2010
    Location
    Australia
    Posts
    98

    Re: is it possible for a file with a customised extension to be non-readable to other

    Suggestion: Google "encryption algorithm c++"

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: is it possible for a file with a customised extension to be non-readable to other

    Quote Originally Posted by Morbane View Post
    Suggestion: Google "encryption algorithm c++"
    Yes, an encryption looks like a good idea here!
    Victor Nijegorodov

  5. #5
    Join Date
    Nov 2010
    Posts
    139

    Re: is it possible for a file with a customised extension to be non-readable to other

    Quote Originally Posted by Morbane View Post
    Suggestion: Google "encryption algorithm c++"
    how would that work? how can i encrypt a file independant from my program? then get my program to decrypt it?
    i can understand having my program encrypt it and decrypt it, but then obviously that wouldnt make sense because the file content can still be viewed by other apps.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: is it possible for a file with a customised extension to be non-readable to other

    Quote Originally Posted by katy_price View Post
    en obviously that wouldnt make sense because the file content can still be viewed by other apps.
    Yes.
    But any other app won't be able to read the file content properly without the key for decryption.
    Victor Nijegorodov

  7. #7
    Join Date
    Nov 2010
    Posts
    139

    Re: is it possible for a file with a customised extension to be non-readable to other

    Quote Originally Posted by VictorN View Post
    Yes.
    But any other app won't be able to read the file content properly without the key for decryption.
    ok, so i create a new program that encrypt the file. then when a user logs in my application to open the file my application will then decrypt it?

    so il have too programs? one to encrypt and another (my login app) to decrypt

    i am going to use the File::Encrypt Method to do this, do you think it will work? or is a good idea?
    Last edited by katy_price; December 20th, 2010 at 11:15 AM.

  8. #8
    Join Date
    Nov 2010
    Posts
    139

    Re: is it possible for a file with a customised extension to be non-readable to other

    i want a file that is created lets say in notepad, to be encrypted. so that if another app other than mine opens it, the content isnt readable. i want when a user logs in to my application (with the correct credentials) for my application to call and open that notepad file in a readable mode (decrypted) so that a user can then read the file content. i want when the notepad file is open and the user can read, edit etc the file and then closes it for it still to be unreadable to other apps. how can i do this, bearing in mind that the File::Encrypt Method doesnt work on my system for some reason. i am working in windows 7 home edition 64 bit.

    p.s my program ends by the way when the file is opened.

  9. #9
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: is it possible for a file with a customised extension to be non-readable to other

    i want it to be unreadable in other applications just like pdf files can't be read in word or notepad is what i want for my file extension. is this possible?
    It's possible, if you're ready to invent your custom file format, and implement its support of course. This is exactly what those programs do: implement file format read/write. And this goes much far than just registration of a customized extension. Besides, custom file format generally has nothing common with encryption or content protection. As you may know, there are other programs that can read pdf files alright.
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured