encrypting a copy of a text file in c# (Windows Forms) -


i'm working on encryption program in c# (windows forms) , 1 of options i'd add user able choose existing text (.txt) file, , program make new file file chosen, encrypted (without making changes in original file). though making copy of original file , encrypting new file, have no clue how it. please tell me how it. lot in advance!

streamreader/streamwriter loading , saving file. streamreader:

string unencryptedtext;     private void readtextfile()     {          using (streamreader reader = new streamreader("file.txt"))         {             unencryptedtext= reader.readtoend();         }     } 

streamwriter

    using (streamwriter writer = new streamwriter("encryptedfile.txt", true))     {         writer.write(encryptedtext);     } 

encryption: simple insecure two-way "obfuscation" c#

update chose directory save encrypted file(only directory)

        folderbrowserdialog fbd = new folderbrowserdialog();         if (fbd.showdialog() == system.windows.forms.dialogresult.ok)          {             using (streamwriter writer = new streamwriter(fbd.selectedpath+"\\encryptedfile.txt", true))             {                 writer.write(encryptedtext);             }         } 

chose directory , filename

        savefiledialog sfd = new savefiledialog();         if (sfd.showdialog() == system.windows.forms.dialogresult.ok)         {             using (streamwriter writer = new streamwriter(sfd.filename, true))             {                 writer.write(encryptedtext);             }         } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -