- Bug 169353. Prompt user for Desktop Password when Master Password is not present.
This commit is contained in:
parent
f6a659b7eb
commit
837669576a
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu May 07 18:16:25 MST 2006 - jnorman@novell.com
|
||||
- Bug 169353. Prompt user for Desktop Password when Master Password
|
||||
is not present.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri May 5 17:51:27 IST 2006 - smanojna@novell.com
|
||||
|
||||
|
@ -78,7 +78,8 @@ namespace Novell.CASA.GUI
|
||||
dialogShortPassword,
|
||||
dialogResetMP,
|
||||
dialogStillRunning,
|
||||
dialogFirefoxMP;
|
||||
dialogFirefoxMP,
|
||||
dialogDeletePersistentFiles;
|
||||
|
||||
[Glade.Widget]
|
||||
Gtk.Entry entryMasterPassword1,
|
||||
@ -376,7 +377,7 @@ namespace Novell.CASA.GUI
|
||||
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
|
||||
|
||||
// did the daemon get restarted before the user created a master password?
|
||||
// if so, let's ask the user for there desktop password and set it if there's a cache file
|
||||
// if so, let's ask the user for their desktop password and set it if there's a cache file
|
||||
if (true == DoPersistentFilesExist())
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogDesktopPassword", null);
|
||||
@ -417,10 +418,7 @@ namespace Novell.CASA.GUI
|
||||
|
||||
if (entryDesktopPassword1.Text.Equals(entryDesktopPassword2.Text))
|
||||
{
|
||||
|
||||
// validate entered desktop password - work in progress
|
||||
//if (miCASA.ValidateDesktopPwd(entryDesktopPassword1.Text))
|
||||
if (true)
|
||||
if (miCASA.ValidateDesktopPwd(entryDesktopPassword1.Text))
|
||||
{
|
||||
// set the desktop password in micasa
|
||||
try
|
||||
@ -445,7 +443,10 @@ namespace Novell.CASA.GUI
|
||||
}
|
||||
else
|
||||
{
|
||||
labelDesktopPasswordMessage.Text = "Your desktop password does not match";
|
||||
labelDesktopPasswordMessage.Text = "This password does not match previous one entered";
|
||||
// TODO: prompt user to retry, or delete their persistent files
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogDeletePersistentFiles", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -457,6 +458,73 @@ namespace Novell.CASA.GUI
|
||||
}
|
||||
}
|
||||
|
||||
public void on_buttonStoreRetry_clicked(object obj, EventArgs args)
|
||||
{
|
||||
if (dialogDeletePersistentFiles != null)
|
||||
dialogDeletePersistentFiles.Destroy();
|
||||
}
|
||||
|
||||
|
||||
public void on_buttonStoreDelete_clicked(object obj, EventArgs args)
|
||||
{
|
||||
// delete .micasa files
|
||||
if (!DeleteMiCasaFiles())
|
||||
{
|
||||
DisplayError("Failed to delete all miCASA files.\r\nCheck you home directory for .miCASA* files.");
|
||||
return;
|
||||
};
|
||||
|
||||
// close this dialog
|
||||
if (dialogDeletePersistentFiles != null)
|
||||
dialogDeletePersistentFiles.Destroy();
|
||||
|
||||
// set desktop password and close dialogDeskPassword
|
||||
// set the desktop password in micasa
|
||||
try
|
||||
{
|
||||
Novell.CASA.miCASA.SetCredential(0,
|
||||
"Desktop",
|
||||
null,
|
||||
Novell.CASA.miCASA.USERNAME_TYPE_CN_F,
|
||||
GetLocalUsername(),
|
||||
entryDesktopPassword1.Text);
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.DbgLog(e.ToString());
|
||||
}
|
||||
|
||||
if (dialogDesktopPassword != null)
|
||||
dialogDesktopPassword.Destroy();
|
||||
|
||||
MasterPasswordAuthentication();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private bool DeleteMiCasaFiles()
|
||||
{
|
||||
string[] faFiles = Directory.GetFiles(GetUserHomeDir(), ".miCASA*");
|
||||
bool bDeletedFiles = true;
|
||||
|
||||
for (int i=0; i<faFiles.Length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(faFiles[i]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.DbgLog(e.ToString());
|
||||
bDeletedFiles = false;
|
||||
}
|
||||
}
|
||||
|
||||
return bDeletedFiles;
|
||||
}
|
||||
|
||||
|
||||
public void on_helpbuttonDesktopPassword_clicked(object obj, EventArgs args)
|
||||
{
|
||||
Common.ShowHelpUrl("CASADesktopPassword.htm");
|
||||
|
@ -4872,13 +4872,53 @@ prompted for the Master Password at startup.</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image490">
|
||||
<widget class="GtkHBox" id="hbox85">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">casa-logo.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image3762">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">casa-logo-left.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkDrawingArea" id="drawingarea2">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image3763">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">casa-logo-right.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
@ -5070,7 +5110,14 @@ Ahmed SK Anis
|
||||
Manohar Mathias
|
||||
CSL Manojna
|
||||
Nagareshwar Talekar
|
||||
L Sreevatsa</b></property>
|
||||
L Sreevatsa
|
||||
Todd Throne
|
||||
Juan Carlos Luciani
|
||||
Michael Bright
|
||||
Kal Larsen
|
||||
Kyle Bullock
|
||||
Colin Green
|
||||
</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
@ -5105,7 +5152,7 @@ L Sreevatsa</b></property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label74">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Authors</b></property>
|
||||
<property name="label" translatable="yes"><b>Contributors</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
@ -11341,4 +11388,306 @@ the following characters
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkDialog" id="dialogDeletePersistentFiles">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Warning</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="icon">CASAicons.ico</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
<property name="has_separator">True</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="vbox143">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox22">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="buttonStoreDelete">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">-3</property>
|
||||
<signal name="clicked" handler="on_buttonStoreDelete_clicked" last_modification_time="Sat, 06 May 2006 21:48:49 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment43">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox84">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image3761">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-delete</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label260">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Delete</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="buttonStoreRetry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">-7</property>
|
||||
<signal name="clicked" handler="on_buttonStoreRetry_clicked" last_modification_time="Sat, 06 May 2006 21:39:52 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment42">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox82">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image3759">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-redo</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label257">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Retry</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox83">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox144">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image3760">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
<property name="icon_size">6</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">4</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox145">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label258">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>The password you entered does not match.</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label259">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">The password you entered does not match the one encrypting your secrets. You can retry entering your workstation password to recover your secrets, or you can delete them.</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">4</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
||||
|
24
c_micasad/cache/SecretStore.cs
vendored
24
c_micasad/cache/SecretStore.cs
vendored
@ -123,7 +123,6 @@ namespace sscs.cache
|
||||
//return true;
|
||||
}
|
||||
|
||||
|
||||
if (sMasterPassword != null)
|
||||
{
|
||||
// verify MasterPassword
|
||||
@ -137,6 +136,29 @@ namespace sscs.cache
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsDesktopPassword(string sDesktopPassword)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] baPasscode = CASACrypto.GetMasterPasscodeUsingDesktopPasswd(sDesktopPassword, GetPasscodeByDesktopFilePath(), false);
|
||||
if(CASACrypto.ValidatePasscode(baPasscode,GetValidationFilePath()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// try old salt
|
||||
baPasscode = CASACrypto.GetMasterPasscodeUsingDesktopPasswd(sDesktopPassword, GetPasscodeByDesktopFilePath(), true);
|
||||
if(CASACrypto.ValidatePasscode(baPasscode,GetValidationFilePath()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal bool StartPersistenceByDesktopPasswd(string desktopPasswd)
|
||||
{
|
||||
CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Called");
|
||||
|
@ -179,7 +179,10 @@ namespace sscs.crypto
|
||||
{
|
||||
//Get an encryptor.
|
||||
RijndaelManaged myRijndael = new RijndaelManaged();
|
||||
ICryptoTransform encryptor = myRijndael.CreateEncryptor(key, GenerateAndSaveIV(fileName, myRijndael));
|
||||
byte[] baIV = GenerateAndSaveIV(fileName, myRijndael);
|
||||
|
||||
|
||||
ICryptoTransform encryptor = myRijndael.CreateEncryptor(key, baIV);
|
||||
|
||||
//Encrypt the data to a file
|
||||
fsEncrypt = new FileStream(fileName, FileMode.Create);
|
||||
@ -235,7 +238,10 @@ namespace sscs.crypto
|
||||
|
||||
//Get a decryptor that uses the same key and IV as the encryptor.
|
||||
RijndaelManaged myRijndael = new RijndaelManaged();
|
||||
ICryptoTransform decryptor = myRijndael.CreateDecryptor(key, RetrieveIV(fileName, key));
|
||||
|
||||
byte[] baIV = RetrieveIV(fileName, IV);
|
||||
|
||||
ICryptoTransform decryptor = myRijndael.CreateDecryptor(key, baIV);
|
||||
#if LINUX
|
||||
UnixFileInfo fsTest = new UnixFileInfo (fileName);
|
||||
if((fsTest == null) || !(fsTest.Exists) || fsTest.IsSymbolicLink)
|
||||
@ -268,6 +274,7 @@ namespace sscs.crypto
|
||||
for(int i = 0 ; i < bytesRead; i++ )
|
||||
tmpEncrypt[i] = fromEncrypt[i];
|
||||
|
||||
|
||||
SHA256 sha = new SHA256Managed();
|
||||
byte[] newHash = sha.ComputeHash(tmpEncrypt);
|
||||
|
||||
@ -300,13 +307,27 @@ namespace sscs.crypto
|
||||
{
|
||||
CSSSLogger.DbgLog(e.ToString());
|
||||
}
|
||||
|
||||
if (csDecrypt != null)
|
||||
{
|
||||
csDecrypt.Close();
|
||||
try
|
||||
{
|
||||
csDecrypt.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if( fsDecrypt != null )
|
||||
{
|
||||
fsDecrypt.Close();
|
||||
try
|
||||
{
|
||||
fsDecrypt.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -419,7 +440,7 @@ namespace sscs.crypto
|
||||
//Get an encryptor.
|
||||
RijndaelManaged myRijndael = new RijndaelManaged();
|
||||
ICryptoTransform encryptor;
|
||||
encryptor = myRijndael.CreateEncryptor(baKey, baKey);
|
||||
encryptor = myRijndael.CreateEncryptor(baKey, GenerateAndSaveIV(fileName, myRijndael));
|
||||
|
||||
//Encrypt the data to a file
|
||||
fsEncrypt = new FileStream(fileName,FileMode.Create);
|
||||
@ -647,6 +668,9 @@ namespace sscs.crypto
|
||||
|
||||
try
|
||||
{
|
||||
if (File.Exists(sFileName + ".IV"))
|
||||
File.Delete(sFileName + ".IV");
|
||||
|
||||
// now save this
|
||||
FileStream fs = new FileStream(sFileName + ".IV", FileMode.Create);
|
||||
fs.Write(baIV, 0, 16);
|
||||
@ -679,7 +703,29 @@ namespace sscs.crypto
|
||||
{
|
||||
CSSSLogger.DbgLog(e.ToString());
|
||||
}
|
||||
return (byte[])baOrigValue.Clone();
|
||||
|
||||
// original IV size was 16 bytes, copy that much
|
||||
if (baOrigValue.Length == 16)
|
||||
{
|
||||
return (byte[])baOrigValue.Clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0; i<16; i++)
|
||||
{
|
||||
IV[i] = baOrigValue[i];
|
||||
}
|
||||
return IV;
|
||||
}
|
||||
}
|
||||
|
||||
private static void DumpIV(byte[] iv)
|
||||
{
|
||||
for (int i=0; i<iv.Length; i++)
|
||||
{
|
||||
Console.Write(iv[i] + " ");
|
||||
}
|
||||
Console.WriteLine("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ using sscs.verbs;
|
||||
using sscs.cache;
|
||||
using sscs.common;
|
||||
using sscs.constants;
|
||||
using sscs.lss;
|
||||
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
@ -212,6 +213,10 @@ namespace sscs.verbs
|
||||
{
|
||||
return DoGetSecretIDs(ssStore, wo);
|
||||
}
|
||||
case MiCasaRequestReply.VERB_VALIDATE_DESKTOP_PWD:
|
||||
{
|
||||
return DoValidateDesktopPwd(ssStore, wo);
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
@ -229,6 +234,24 @@ namespace sscs.verbs
|
||||
return wo;
|
||||
}
|
||||
|
||||
private WrappedObject DoValidateDesktopPwd(SecretStore ssStore, WrappedObject wo)
|
||||
{
|
||||
// let's validate the Desktop pwd
|
||||
|
||||
String sDesktopPwd = (String)wo.GetObject();
|
||||
bool bIsValid = ssStore.IsDesktopPassword(sDesktopPwd);
|
||||
if (bIsValid)
|
||||
{
|
||||
wo.SetObject("true");
|
||||
}
|
||||
else
|
||||
{
|
||||
wo.SetObject("false");
|
||||
}
|
||||
|
||||
return wo;
|
||||
}
|
||||
|
||||
private WrappedObject DoGetSecretIDs(SecretStore ssStore, WrappedObject wo)
|
||||
{
|
||||
if (!ssStore.IsStoreLocked())
|
||||
|
@ -154,6 +154,10 @@ namespace sscs.verbs
|
||||
#endif
|
||||
}
|
||||
|
||||
if (secretId.Length < 1 || key.Length < 1 || valStr.Length < 1)
|
||||
{
|
||||
CSSSLogger.DbgLog("Error in length");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -152,5 +152,17 @@ namespace Novell.CASA
|
||||
return NativeCalls.ResetMasterPassword(sCurrentPassword, sNewPassword);
|
||||
|
||||
}
|
||||
|
||||
public static bool ValidateDesktopPwd(string sPassword)
|
||||
{
|
||||
if (sPassword != null)
|
||||
{
|
||||
return NativeCalls.ValidateDesktopPwd(sPassword);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user