how to extracting a key and IV to another application

Jun 16 2004 3:20 PM
I'm trying to get two seperate applications to encrypty with the same private key. So in one program I'm generating a key and extracting the key and IV(initializtiong vector), then I would want to copy this over to the other application and use the same key and initilization vector, but it doesn't quite work because the conversion into a string is NOT readable. The issue is how do you transfer the key and IV to another application. ---------------------------------------------------------------------- UnicodeEncoding enc = new UnicodeEncoding(); TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider(); //generate first key tdes.GenerateKey(); // here is the text version of the first key UNREADABLE MessageBox.Show(enc.GetString(tdes.Key)); // the reason I'm extracting the strings below is that the other program does not have access // to this program so I would have to extract the strings to copy and //past these but they are unreadable because of the conversion // extract the string representation of the IV string iv = enc.GetString(tdes.IV); // extract the string representation of the key string key = enc.GetString(tdes.Key); // here is the second tripledes TripleDESCryptoServiceProvider tdes1 = new TripleDESCryptoServiceProvider(); // create the second triple des with the above key and IV tdes1.CreateEncryptor(enc.GetBytes(key),enc.GetBytes(iv)); // BUT THE STRING REPRESENTATION IS ALSO UNREADABLE??? MessageBox.Show(enc.GetString(tdes1.Key).ToString()); --------------------------------------------------------------------------- So how would one get two applications to use the same key and IV?

Answers (1)