diff --git a/CASA/micasad/common/SessionManager.cs b/CASA/micasad/common/SessionManager.cs index 20c2fc84..b25129d1 100644 --- a/CASA/micasad/common/SessionManager.cs +++ b/CASA/micasad/common/SessionManager.cs @@ -105,8 +105,21 @@ namespace sscs.common mutex.ReleaseMutex(); ss = user.GetSecretStore(); ss.IncrRefCount(); - ss.CreateTime = DateTime.Now; - ss.StartPersistenceOfServerSecretsBySystemKey(); + ss.CreateTime = DateTime.Now; + + // add session keychain if it does not exist. + if (!ss.CheckIfKeyChainExists(constants.ConstStrings.SSCS_SESSION_KEY_CHAIN_ID + '\0')) + { + ss.AddKeyChain(new KeyChain(constants.ConstStrings.SSCS_SESSION_KEY_CHAIN_ID + '\0')); + } + + // add server keychain if it does not exist. + if (!ss.CheckIfKeyChainExists(constants.ConstStrings.SSCS_SERVER_KEY_CHAIN_ID + '\0')) + { + ss.AddKeyChain(new KeyChain(constants.ConstStrings.SSCS_SERVER_KEY_CHAIN_ID + '\0')); + } + + ss.StartPersistenceOfServerSecretsBySystemKey(); return ss; } }