Improve persistence experience for the user
This commit is contained in:
parent
d17617d6fd
commit
d100d3d36f
54
c_micasad/cache/SecretStore.cs
vendored
54
c_micasad/cache/SecretStore.cs
vendored
@ -149,9 +149,16 @@ namespace sscs.cache
|
|||||||
CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Started");
|
CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Started");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!File.Exists(GetPasscodeByDesktopFilePath()))
|
if(!File.Exists(GetPasscodeByDesktopFilePath()))
|
||||||
{
|
{
|
||||||
|
if (File.Exists(GetPasscodeByMasterPasswdFilePath()))
|
||||||
|
{
|
||||||
|
// wait for the user to start the Persistence by entering MP
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//Else passcode needs to be generated.
|
//Else passcode needs to be generated.
|
||||||
baPasscode = CASACrypto.GenerateMasterPasscodeUsingString(
|
baPasscode = CASACrypto.GenerateMasterPasscodeUsingString(
|
||||||
desktopPasswd,
|
desktopPasswd,
|
||||||
@ -164,19 +171,12 @@ namespace sscs.cache
|
|||||||
|
|
||||||
if(!File.Exists(GetKeyFilePath()))
|
if(!File.Exists(GetKeyFilePath()))
|
||||||
{
|
{
|
||||||
RijndaelManaged myRijndael = new RijndaelManaged();
|
GenerateAndStoreEncryptionKey(baPasscode);
|
||||||
byte[] key;
|
lss = new LocalStorage(this,baPasscode);
|
||||||
byte[] IV = new byte[16];
|
bIsStorePersistent = true;
|
||||||
//Create a new key and initialization vector.
|
return true;
|
||||||
myRijndael.GenerateKey();
|
|
||||||
key = myRijndael.Key;
|
|
||||||
CASACrypto.StoreKeySetUsingMasterPasscode(key,IV,
|
|
||||||
baPasscode,
|
|
||||||
GetKeyFilePath());
|
|
||||||
}
|
}
|
||||||
lss = new LocalStorage(this,baPasscode);
|
|
||||||
bIsStorePersistent = true;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
baPasscode = CASACrypto.GetMasterPasscodeUsingDesktopPasswd(desktopPasswd, GetPasscodeByDesktopFilePath());
|
baPasscode = CASACrypto.GetMasterPasscodeUsingDesktopPasswd(desktopPasswd, GetPasscodeByDesktopFilePath());
|
||||||
if(baPasscode != null)
|
if(baPasscode != null)
|
||||||
@ -209,6 +209,29 @@ namespace sscs.cache
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal bool GenerateAndStoreEncryptionKey(byte[] baPasscode)
|
||||||
|
{
|
||||||
|
RijndaelManaged myRijndael = new RijndaelManaged();
|
||||||
|
byte[] key;
|
||||||
|
byte[] IV = new byte[16];
|
||||||
|
//Create a new key and initialization vector.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
myRijndael.GenerateKey();
|
||||||
|
key = myRijndael.Key;
|
||||||
|
|
||||||
|
CASACrypto.StoreKeySetUsingMasterPasscode(key,IV,
|
||||||
|
baPasscode,
|
||||||
|
GetKeyFilePath());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
internal bool SetMasterPassword(string mPasswdFromIDK)
|
internal bool SetMasterPassword(string mPasswdFromIDK)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -288,6 +311,11 @@ namespace sscs.cache
|
|||||||
baPasscode = CASACrypto.GenerateMasterPasscodeUsingString(mPasswd,GetPasscodeByMasterPasswdFilePath(),GetValidationFilePath(), user.UserIdentifier);
|
baPasscode = CASACrypto.GenerateMasterPasscodeUsingString(mPasswd,GetPasscodeByMasterPasswdFilePath(),GetValidationFilePath(), user.UserIdentifier);
|
||||||
if(baPasscode != null)
|
if(baPasscode != null)
|
||||||
{
|
{
|
||||||
|
if(!File.Exists(GetKeyFilePath()))
|
||||||
|
{
|
||||||
|
GenerateAndStoreEncryptionKey(baPasscode);
|
||||||
|
}
|
||||||
|
|
||||||
CASACrypto.EncryptAndStoreMasterPasscodeUsingString(baPasscode,mPasswd,GetPasscodeByMasterPasswdFilePath());
|
CASACrypto.EncryptAndStoreMasterPasscodeUsingString(baPasscode,mPasswd,GetPasscodeByMasterPasswdFilePath());
|
||||||
if( bIsStorePersistent == false )
|
if( bIsStorePersistent == false )
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ namespace Novell.CASA.MiCasa.Common
|
|||||||
if (sSecretID != null)
|
if (sSecretID != null)
|
||||||
{
|
{
|
||||||
if (sSecretID.StartsWith("SS_CredSet"))
|
if (sSecretID.StartsWith("SS_CredSet"))
|
||||||
m_SecretID = "SS_CredSet:" + EscapeReservedChars(sSecretID.Substring(12)) + '\0';
|
m_SecretID = "SS_CredSet:" + EscapeReservedChars(sSecretID.Substring(11)) + '\0';
|
||||||
else
|
else
|
||||||
m_SecretID = "SS_CredSet:" + EscapeReservedChars(sSecretID) + '\0';
|
m_SecretID = "SS_CredSet:" + EscapeReservedChars(sSecretID) + '\0';
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,12 @@ namespace sscs.lss
|
|||||||
if (File.Exists(fileName+".tmp"))
|
if (File.Exists(fileName+".tmp"))
|
||||||
File.Delete(fileName+".tmp");
|
File.Delete(fileName+".tmp");
|
||||||
|
|
||||||
byte[] baPasscode = CASACrypto.GetMasterPasscode(userStore.GetDesktopPasswd(),userStore.GetPasscodeByDesktopFilePath());
|
byte[] baPasscode = null;
|
||||||
|
if (null != m_baGeneratedKey)
|
||||||
|
baPasscode = m_baGeneratedKey;
|
||||||
|
else
|
||||||
|
baPasscode = CASACrypto.GetMasterPasscode(userStore.GetDesktopPasswd(),userStore.GetPasscodeByDesktopFilePath());
|
||||||
|
|
||||||
if( null == baPasscode )
|
if( null == baPasscode )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ namespace sscs.verbs
|
|||||||
|
|
||||||
private ushort msgId = 0;
|
private ushort msgId = 0;
|
||||||
private uint inMsgLen = 0;
|
private uint inMsgLen = 0;
|
||||||
|
|
||||||
|
|
||||||
private byte[] inBuf;
|
private byte[] inBuf;
|
||||||
private byte[] outBuf;
|
private byte[] outBuf;
|
||||||
@ -657,7 +656,7 @@ namespace sscs.verbs
|
|||||||
|
|
||||||
private WrappedObject DoPing(WrappedObject wo)
|
private WrappedObject DoPing(WrappedObject wo)
|
||||||
{
|
{
|
||||||
Console.WriteLine("MICASAD received Ping from Client");
|
//Console.WriteLine("MICASAD received Ping from Client");
|
||||||
wo.SetError(IPCRetCodes.SSCS_REPLY_SUCCESS, null);
|
wo.SetError(IPCRetCodes.SSCS_REPLY_SUCCESS, null);
|
||||||
|
|
||||||
Ping ping = (Ping)wo.GetObject();
|
Ping ping = (Ping)wo.GetObject();
|
||||||
|
Loading…
Reference in New Issue
Block a user