Thread: How to write metadata into files?

  1. #1
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195

    How to write metadata into files?

    I need to create a program which has a bit of a database back end, so I was thinking of creating files of a file format of my own personal design with metadata in there some how which would include things like the password needed to access the file, the key(s) for encryption etc and probably some form of checksum to try and prevent outside data manipulation. The only problem is, I have no idea how to add metadata to a file, how to access it etc. Eventually, I might want to add in formatting and font information aswell, but for now, I'll leave that one out

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Why would adding metadata be different than adding data?

  3. #3
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195
    I suppose there isn't, but I will have sensitive data in there, i.e. password and encryption keys, is there any way I can try and restrict access to them from other programs, because otherwise just looking at the file through a hex viewer would probably tell you straight out all the info you need to know?

    How would I do that?

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There is no way to "protect" certain areas of a file.

    In this sense, metadata is no different from regular data.

    Like all "protection", it depends quite a bit on who/what you are trying to protect against. Professional hackers, some one sitting in their room trying to break in, or "your little brother".

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    A simple encryption will most likely be enough for your purposes, unless you're doing something that's intended as a commercial product.

    A shift cipher that'll shift all chars into unreadable characters should do the trick, since a hex editor will then reveal nothing but gibberish.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to write to files ?
    By Akilla in forum C++ Programming
    Replies: 6
    Last Post: 07-08-2002, 12:01 PM
  2. The problem read and write in files
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 07-05-2002, 12:54 PM
  3. write in c
    By PutoAmo in forum C Programming
    Replies: 6
    Last Post: 04-03-2002, 07:53 PM
  4. Can I not call fstream to write to two files sequentially?
    By tigeress in forum C++ Programming
    Replies: 1
    Last Post: 01-20-2002, 01:26 PM
  5. Write and use data stored in data files...
    By alex6852 in forum C++ Programming
    Replies: 2
    Last Post: 11-01-2001, 01:45 PM