Thread: Folder Encryption

  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155

    Question Folder Encryption

    For about two days I've been trying to figure out how to make a C++ program encrypt a folder under the FAT 32 type. I still can't figure out how to do this!

    I can easily encrypt files though.

    My file type:

    Code:
    >Enter file name: file.txt
    >Enter output file name: file2.txt
    >Sucessfully encrypted!!
    but when I try a folder:
    Code:
    >Enter file name: foldername
    >Error! File dosn't exist!
    >
    >Enter file name:
    How can I encrypt a folder?
    ~guitarist809~

  2. #2
    Registered User
    Join Date
    Apr 2006
    Posts
    1
    Did you write this program? If not, you're probably going to need to get in touch with the person who did.

    If you wrote the program, what API are you using to encrypt the files? Perhaps it is only capable of encrypting files. If that's the case, then your should probably pack the folder and its contents into a single archive (using tar, perhaps, if you're on a unix system) and then encrypt that archive.

  3. #3
    C++ Newbie
    Join Date
    Jul 2005
    Location
    Plovdiv, Bulgaria
    Posts
    11
    Folder encryption is way more complex, becasue the program must encrypt every file in it too. Look at it as a DOS process, you have to go torught every file by hand. My guess would be the program can't encrypt folders.

  4. #4
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155
    hmm. I don't use an API. I do:

    Code:
    void crypt(string salt, string text, string& output)
    {
        int a = 0;
        
        for(int i = 0; i < text.length(); i++)
        {
             for (a = 0; a < salt.length(); a++)
             {
                  if (a > salt.length())
                  a = 0;
                    
                  text[i] += salt[a];
                } 
        }
        output = text;
        ofstream utput ("output.txt");
        utput << output;
        utput.close();
    }
    void decrypt(string salt, string text, string& output)
    {
        int a = 0;
        
        for(int i = 0; i < text.length(); i++)
        {
             for (a = 0; a < salt.length(); a++)
             {
                  if (a > salt.length())
                  a = 0;
                    
                  text[i] -= salt[a];
                } 
        }
        output = text;
    }
    ~guitarist809~

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    I used the Windows API for a similiar program I wrote. You'll need to rewrite your program to recursively navigate through subfolders.

  6. #6
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155
    ahhhh. ok
    ~guitarist809~

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 09:52 PM
  2. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  3. Hiding a folder
    By nextstep in forum Windows Programming
    Replies: 16
    Last Post: 03-20-2005, 03:07 PM
  4. Folder encryption
    By EvBladeRunnervE in forum Tech Board
    Replies: 7
    Last Post: 12-11-2004, 10:03 PM
  5. Using fopen on a folder
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-16-2002, 06:49 PM