Need Help with a part of my encryption program PLEASE!

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2004
Posts: 37
Reputation: crypter is an unknown quantity at this point 
Solved Threads: 0
crypter's Avatar
crypter crypter is offline Offline
Light Poster

Need Help with a part of my encryption program PLEASE!

 
0
  #1
Jan 19th, 2005
Hi all! I am creating a program to encrypt files in Rijndael 64 bit encryption. I am having a problem with one of the aspects i want to include in my code. It sounds very basic maybe but i have tried many things and somehow i can't seem to figure out why i can't solve the problem.
Ok you might be wondering what the problem is! well its simple read the code elow and then, i will explain my dilema, or even better if you are good enough you'll find out on your own.

  1. private void button3_Click(object sender, System.EventArgs e)
  2. {
  3. if (textBox2.Text != textBox3.Text || textBox3.Text == "")
  4. {
  5. MessageBox.Show("The passwords you chose do not match or text boxs are empty! Type the new password again", "Error");
  6. Thread.CurrentThread.Start();
  7. }
  8. LabelChange();
  9. string encType = comboBox1.SelectedItem.ToString();
  10. switch(encType)
  11. {
  12. case "Rijndael 64 bits":
  13. password = textBox3.Text;
  14. EncryptFile1();
  15. break;
  16. default:
  17. Close();
  18. break;
  19. }
  20. }

Alright, now guys, the problem is that, i have 2 text boxes, one text box to enter key and the other to confirm the key chosen.
I have code there will verify both keys in both text boxes and give out a message box that tell you if they are not the same.
All that is great! But when it comes to encrypt and both keys don't match, it gives out the warning message but keeps on encrypting using the confirm key text box through this code:

  1. password = textBox3.Text;

I had no choice on choosing one box as the password, or else the program itself woudln't work!
Now to prevent the encryption when you enter to keys that do not match, i put this code that just creates an error.

  1. Thread.CurrentThread.Start();


Would there be a way to overcome this code and actually make the program STOP encrypting if the keys are not equivalent. It would be great if someone can solve this problem of mine. And if you can there is another problem. If you uys got time and want to take a shot at it, its up to you.
I decided not to include a progress bar thinking it would take too much time and code to be able to make that thing work so i decided the do soething a bit more primitive if you like. I decided to make a label that will change text when you go through the steps of encryption. I also wanted to change the text of the label to write "processing..." Will encrypting, that thing the program kinda stops responding while encrypting and does not display the change in label. I was wondering if there was a way of overcoming that situation with some code.

Well thats it folks, i hope you guys can help with my dilemas! Anyways take care! and hope to hear from you guys soon! Thanks in advance

Crypter
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: Need Help with a part of my encryption program PLEASE!

 
0
  #2
Jan 20th, 2005
you need braces:

  1. switch(encType)
  2. {
  3. case "Rijndael 64 bits":
  4. {
  5. password = textBox3.Text;
  6. EncryptFile1();
  7. }
  8. break;
  9. default:
  10. Close();
  11. break;
  12. }

Which COULD be a source of the problem.

As for the mis-matched keys what about:

  1. if keys are equal
  2. encrypt
  3. else
  4. {
  5. warning
  6. dont encrypt
  7. }
as a framework?
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 55
Reputation: r0ckbaer is an unknown quantity at this point 
Solved Threads: 6
r0ckbaer r0ckbaer is offline Offline
Junior Poster in Training

Re: Need Help with a part of my encryption program PLEASE!

 
0
  #3
Jan 20th, 2005
after :
MessageBox.Show("The passwords you chose do not match or text boxs are empty! Type the new password again", "Error");

write: return;
instead of: Thread.CurrentThread.Start(); <--which doesnt do anything anyway in the snippet you pasted
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC