I am currently working on a Encryption/Decryption exercise. Main functionality is done however it was done in console. Now I will create the application in win form.
My Encryption/Decryption methods take byte arrays as arguments. I used DES as per program specifications. I was population the byte arrays like this
//were mk is a string
byte[] mkBytes = System.Text.UTF8Encoding.UTF8.GetBytes(mk);
However CreateDecryptor method was giving "Specified key is not a valid size for this algorithm"
error.
Therefore to go around the problem I was forced to do this, hard code the whole bit array and worked fine.
byte[] masterKey_bytearr = { 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23 };
But now I face the problem again since the user will be inputting the string in a textbox and cannot hard code them myself. How can I get the string from textbox and assign it to a byte[] suitable for DES CreateDecryptor method?