none
File / Extension Exclusion C# RRS feed

  • Question

  • So i'm working on a personal software which encrypts and decrypts a file that the user has choosen. I though of putting a function to encrypt the whole current user to secure the data or make it temporally readable depending on the encryption they choose. Though the following files blocks the encryption because their are protected and need to be exclude while grabbing files and directories of the user:

    desktop.ini

    NTUSER.DAT

    So i tried exclude them but doesn't work. I also want to stop it from being encrypted from the file encrypt function in the user form so windows the user can select a file to encrypt but i want to exclude them so the user cannot encrypt them.

    Please help me ;c i'm stuck and tried every code...

    Lots of love!

    Sunday, June 24, 2018 9:40 AM

All replies

  • First step is to show code that you have so we can provide suggestions or solutions. Without this we can not assist you.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Sunday, June 24, 2018 11:56 AM
    Moderator
  • We need more details of what you need help with. Note that questions should be specific; these forums do not work best for general conceptual questions.


    Sam Hobbs
    SimpleSamples.Info

    Sunday, June 24, 2018 8:19 PM
  • Ok here if you need my code. I wont put my whole code since i don't want it to be stolen... i will only put the code of the form load when it checks for the directories etc

            public void Form1_Load(object sender, EventArgs e)
            {

                    String userName = Environment.UserName; // Grabs current user and sets it has the userName.
                    string path = "C:\\Users\\" + userName;
                foreach (string file in file2check) // #DFG START : Grabs all files in the user directory
                {
                    string key = "CENSORED KEY SORRY"; // Sets key to encrypt in TripleDES
                    string key2 = "CENSORED KEY SORRY"; // Sets key to encrypt in AES
                    string IV = "CENSORED KEY SORRY"; // Sets IV to use in encryption with AES
                    listBox2.Items.Add(file); // Sets item in listBox2 to display avaible files.
                }
            }

    All ineed is the foreach string to check all the files in the CURRENT user directory and filters out .ini files and .DAT files and important system files so in case the system doesn't break ;c 

    I censored the keys for the privacy etc i hope you understand... 

    Thanks you!

    Sunday, June 24, 2018 11:24 PM
  • Are you aware that tools to do this have existed for a very long time?  All versions of Windows 10 (except Home) have this ability built-in to Explorer.  And there is an excellent open source tool called "ccrypt" that has been trusted for many years.

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Tuesday, June 26, 2018 4:57 AM
  • Yes i'm, but i do what i want and i wanna to make softwares to get better into programming we all started programming by doing a simple hello world into console or something, well its like saying "Are you aware tbat someone has done it before?" Thanks sherlock we all start somewhere right? So yeah....and plus i do what programs i wanna to do right? PLUS this is personal but i like doing my own programs for myself and publish for others.
    Tuesday, June 26, 2018 5:41 AM
  • Yes i'm, but i do what i want and i wanna to make softwares to get better into programming we all started programming by doing a simple hello world into console or something, well its like saying "Are you aware tbat someone has done it before?" Thanks sherlock we all start somewhere right? So yeah....and plus i do what programs i wanna to do right? PLUS this is personal but i like doing my own programs for myself and publish for others.

    I hope it helps for me to say I understand. I very much understand the need to explore and figure things out. Quite often it helps to understand what the motivation is but I would not criticize a desire to explore except sometimes explorers want other people to invest a lot of time trying to help them.

    I was in the hospital all week last week and that is the main reason I have not spent much time on this. I think it is reasonable for me to at least look at your code.



    Sam Hobbs
    SimpleSamples.Info

    Tuesday, June 26, 2018 9:03 PM
  • First let us know if this is another way to get the files. If you can use this then what else do you have questions about?

    string DocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    DirectoryInfo di = new DirectoryInfo(DocumentsPath);
    IEnumerable<FileInfo> files = di.EnumerateFiles();
    foreach (FileInfo fi in files)
    {
        // do your stuff here
    }
    



    Sam Hobbs
    SimpleSamples.Info

    Tuesday, June 26, 2018 10:28 PM
  • Encrypts the file a user has chosen? So you are no longer trying to create a "joke" app that auto-encrypts files of your friends like you posted over here and for which it was marked a violation of the T&Cs? It sounds an awful lot like you are still going down this path.


    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, June 27, 2018 12:53 PM
    Moderator