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,