From dde35a9c061298fb6be778add0d9618531cf6da2 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Thu, 13 Oct 2005 18:23:42 +0000 Subject: [PATCH] Change KeyGeneration for MasterPasscode per SRB. --- c_micasad/lss/CASACrypto.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/c_micasad/lss/CASACrypto.cs b/c_micasad/lss/CASACrypto.cs index 0714d6a6..af1dfaa8 100644 --- a/c_micasad/lss/CASACrypto.cs +++ b/c_micasad/lss/CASACrypto.cs @@ -432,15 +432,14 @@ namespace sscs.crypto { try { - /* Generate passcode using desktop passwd and store - * it in the passwd file encrypted with the desktop passwd. - * Encrypt a well-known with the passcode and store it. - * Return the generated passcode. - */ - Random random = new Random(desktopPasswd.GetHashCode()); - int randNum = random.Next(); - string randStr = randNum.ToString() + userId.GetUID().ToString(); - byte[] baPasscode = Generate16ByteKeyFromString(randStr); + byte[] baPasscode; + // use AES to generate a random 16 byte key; + RijndaelManaged myRijndael = new RijndaelManaged(); + myRijndael.KeySize = 128; + //Create a new key and initialization vector. + myRijndael.GenerateKey(); + baPasscode = myRijndael.Key; + EncryptAndStoreMasterPasscodeUsingString(baPasscode, desktopPasswd,