Hello everybody,
Lab9.3 Working on File Encryption - got this to work
Lab9.4 Working on File Decryption - got this to work
The first lines in the book look like this:
// Read the command-line parameters
//example c:\myfile\abc.txt The file has some data to be encrypted
string inputFilePath = args[0];
//example c:\myfile\abcEncrpt.txt This file will be used to save the encrypted format of the input file
string OutputFilePath = args[1];
//provide any password
string filePassword = args[2];
When I tried to compile, I got this error:
Index was outside the bounds of the array.
I could have also changed it to something like this:
string filePassword;
Console.WriteLine("Enter a Password to decrypy the file");
filePassword = Console.ReadLine();
So I changed the code to the following and got it to work:
string inputFilePath = "crptTest.txt";
string OutputFilePath = "crypTestEncrpted.txt";
string filePassword = "Password";
To improved in this I could hyave done something like:
string filePassword;
Console.WriteLine("Enter a Password to decrypt the file");
filePassword = Console.ReadLine();
So here's my question how should I have done it using the args that was defined:
static void Main(string[] args)
I found a cool example on MSDN, but did not work. And I think it is because a similar reason. here is the link:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.rfc2898derivebytes.aspx[
^]
or just google Rfc2898DeriveBytes MSDN.
I feel as though I am missing something, even though I got both labs to work, and had fun modifying the code so that the password was not hard coded.
Any feedback on this would be greatly appreciated.
Thanks in advance.