예제 #1
0
 private static bool PassphraseHelper( EnterPassPhraseDialog epd, string DomainID, SimiasWebService simws)
 {
     bool status = false;
       int result;
     do
     {
       result = epd.Run();
      if(result == (int)ResponseType.Cancel || result == (int) ResponseType.DeleteEvent)
      {
         epd.Hide();
       return false;
     }
       if( epd.PassPhrase != epd.RetypedPassPhrase )
       {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     null,
     iFolderMsgDialog.DialogType.Error,
     iFolderMsgDialog.ButtonSet.None,
     Util.GS("passphrase mismatch"),
     Util.GS("The passphrase and retyped passphrase are not same"),
        Util.GS("Please enter the passphrase again"));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
       }
     else
     {
         break;
     }
     }while( result != (int)ResponseType.Cancel );
       if( result != (int)ResponseType.Cancel || result != (int) ResponseType.DeleteEvent)
       {
        string publicKey = null;
        if( epd.RecoveryAgent != null && epd.RecoveryAgent != "Server_Default")
        {
     byte [] RACertificateObj = DomainController.GetDomainController().GetRACertificate(DomainID, epd.RecoveryAgent);
     if( RACertificateObj != null && RACertificateObj.Length != 0)
     {
      System.Security.Cryptography.X509Certificates.X509Certificate Cert = new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
      CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
      if (!Util.RegisterModalWindow(dlg))
      {
       dlg.Destroy();
       dlg = null;
       return false;
      }
      int res = dlg.Run();
      dlg.Hide();
      dlg.Destroy();
      dlg = null;
      if( res == (int)ResponseType.Ok)
      {
       publicKey = Convert.ToBase64String(Cert.GetPublicKey());
      }
      else
      {
                 status = false;
           simws.StorePassPhrase(DomainID, "", CredentialType.None, false);
       return ShowEnterPassPhraseDialog(DomainID, simws);
      }
     }
         status = SetPassPhrase( epd, DomainID, publicKey, simws );
         epd.Hide();
         return status;
        }
       else
       {
      DomainInformation domainInfo = (DomainInformation)simws.GetDomainInformation(DomainID);
                 string memberID = domainInfo.MemberUserID;
       iFolderWebService ifWebService = DomainController.GetiFolderService();
      publicKey = ifWebService.GetDefaultServerPublicKey(DomainID,memberID);
                 status = SetPassPhrase(epd,DomainID,publicKey,simws);
                 epd.Hide();
                 return status;
       }
       }
     else
     {
     epd.Hide();
     }
     return true;
 }
예제 #2
0
        /// <summary>
        /// Event Handler for Reset Clicked
        /// </summary>
        private void OnResetClicked(object o, EventArgs args)
        {
            Debug.PrintLine("Reset clicked");
            string publicKey = null;
            bool   reset     = false;

            try
            {
                if (this.GdkWindow != null)
                {
                    this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
                }
                DomainController domainController = DomainController.GetDomainController();

                Status passphraseStatus = simws.ValidatePassPhrase(this.Domain, this.OldPassphrase);
                if (passphraseStatus != null)
                {
                    iFolderMsgDialog dialog = null;
                    if (passphraseStatus.statusCode == StatusCodes.PassPhraseInvalid)                      // check for invalid passphrase
                    {
                        dialog = new iFolderMsgDialog(
                            null,
                            iFolderMsgDialog.DialogType.Error,
                            iFolderMsgDialog.ButtonSet.None,
                            Util.GS("Invalid PassPhrase"),
                            Util.GS("The Current PassPhrase entered is not valid"),
                            Util.GS("Please enter the passphrase again"));
                    }
                    else if (passphraseStatus.statusCode == StatusCodes.ServerUnAvailable)
                    {
                        dialog = new iFolderMsgDialog(
                            null,
                            iFolderMsgDialog.DialogType.Info,
                            iFolderMsgDialog.ButtonSet.None,
                            Util.GS("No Logged-In domains"),
                            Util.GS("There are no logged-in domains for changing the passphrase."),
                            Util.GS("For changing passphrase the domain should be connected. Log on to the domain and try."));
                    }

                    if (dialog != null)
                    {
                        dialog.Run();
                        dialog.Hide();
                        dialog.Destroy();
                        dialog = null;
                        return;
                    }
                }
                if (this.RAName != "DEFAULT")
                {
                    byte [] RACertificateObj = domainController.GetRACertificate(this.Domain, this.RAName);
                    if (RACertificateObj != null && RACertificateObj.Length != 0)
                    {
                        System.Security.Cryptography.X509Certificates.X509Certificate Cert =
                            new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
                        CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
                        if (!Util.RegisterModalWindow(dlg))
                        {
                            dlg.Destroy();
                            dlg = null;
                            return;
                        }
                        int res = dlg.Run();
                        dlg.Hide();
                        dlg.Destroy();
                        dlg = null;
                        if (res == (int)ResponseType.Ok)
                        {
                            publicKey = Convert.ToBase64String(Cert.GetPublicKey());
                            Debug.PrintLine(String.Format(" The public key is: {0}", publicKey));
                            reset = true;
                        }
                        else
                        {
                            reset = false;
                            Debug.PrintLine("Response type is not ok");
                            return;
                        }
                    }
                }
                else
                {
                    DomainInformation domainInfo = (DomainInformation)this.simws.GetDomainInformation(this.Domain);

                    string memberUID = domainInfo.MemberUserID;

                    publicKey = this.ifws.GetDefaultServerPublicKey(this.Domain, memberUID);
                    reset     = true;
                }
                if (reset == true)
                {
                    try
                    {
                        status = domainController.ReSetPassphrase(this.Domain,
                                                                  this.OldPassphrase,
                                                                  this.NewPassphrase,
                                                                  this.RAName, publicKey);

                        //clear the values
                        simws.StorePassPhrase(this.Domain, "", CredentialType.None, false);
                        //set the values

                        simws.StorePassPhrase(this.Domain, this.NewPassphrase, CredentialType.Basic, this.SavePassphrase);
                    }
                    catch (Exception ex)
                    {
                        //add client debug log here
                        throw ex;
                    }
                }
                if (status == false)
                {
                    iFolderMsgDialog dialog = new iFolderMsgDialog(
                        null,
                        iFolderMsgDialog.DialogType.Error,
                        iFolderMsgDialog.ButtonSet.None,
                        Util.GS("Change Passphrase"),
                        Util.GS("Unable to change the Passphrase"),
                        Util.GS("Please try again"));
                    dialog.Run();
                    dialog.Hide();
                    dialog.Destroy();
                    dialog = null;
                }
            }
            catch (Exception e)
            {
                Debug.PrintLine(String.Format("Exception in reset passphrase : {0}", e.Message));
            }
            if (this.GdkWindow != null)
            {
                this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
            }
        }
예제 #3
0
 private static bool PassphraseHelper( EnterPassPhraseDialog epd, string DomainID, SimiasWebService simws)
 {
     bool status = false;
       int result;
     do
     {
       result = epd.Run();
      if(result == (int)ResponseType.Cancel || result == (int) ResponseType.DeleteEvent)
      {
         epd.Hide();
       return false;
     }
       if( epd.PassPhrase != epd.RetypedPassPhrase )
       {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     null,
     iFolderMsgDialog.DialogType.Error,
     iFolderMsgDialog.ButtonSet.None,
     Util.GS("passphrase mismatch"),
     Util.GS("The passphrase and retyped passphrase are not same"),
        Util.GS("Please enter the passphrase again"));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
       }
     else
     {
         break;
     }
     }while( result != (int)ResponseType.Cancel );
       if( result != (int)ResponseType.Cancel || result != (int) ResponseType.DeleteEvent)
       {
        string publicKey = null;
        if( epd.RecoveryAgent != null)
        {
     byte [] RACertificateObj = DomainController.GetDomainController().GetRACertificate(DomainID, epd.RecoveryAgent);
     if( RACertificateObj != null && RACertificateObj.Length != 0)
     {
      System.Security.Cryptography.X509Certificates.X509Certificate Cert = new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
      CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
      if (!Util.RegisterModalWindow(dlg))
      {
       dlg.Destroy();
       dlg = null;
       return false;
      }
      int res = dlg.Run();
      dlg.Hide();
      dlg.Destroy();
      dlg = null;
      if( res == (int)ResponseType.Ok)
      {
       publicKey = Convert.ToBase64String(Cert.GetPublicKey());
      }
      else
      {
                 status = false;
           simws.StorePassPhrase(DomainID, "", CredentialType.None, false);
       return ShowEnterPassPhraseDialog(DomainID, simws);
      }
     }
         status = SetPassPhrase( epd, DomainID, publicKey, simws );
         epd.Hide();
         return status;
        }
     else
     {
         iFolderMsgDialog dg = new iFolderMsgDialog(
             epd,
             iFolderMsgDialog.DialogType.Warning,
             iFolderMsgDialog.ButtonSet.YesNo,
             "No Recovery Agent",
             Util.GS("Recovery Agent Not Selected"),
             Util.GS("There is no Recovery Agent selected. Encrypted data cannot be recovered later, if passphrase is lost. Do you want to continue?"));
       int rc = dg.Run();
        dg.Hide();
      dg.Destroy();
         if( (ResponseType)rc == ResponseType.Yes )
         {
             status = SetPassPhrase( epd, DomainID, publicKey, simws );
             epd.Hide();
             return status;
         }
         else
         {
             epd.Hide();
             PassphraseHelper( epd, DomainID, simws );
         }
     }
       }
     else
     {
     epd.Hide();
     }
     return true;
 }
 private void OnResetClicked( object o, EventArgs args)
 {
     Debug.PrintLine("Reset clicked");
        string publicKey = null;
        bool reset = false;
        DomainController domainController = DomainController.GetDomainController();
        try{
        Status passphraseStatus = simws.ValidatePassPhrase(this.Domain, this.OldPassphrase);
        if( (passphraseStatus != null)
     && (passphraseStatus.statusCode == StatusCodes.PassPhraseInvalid))
       {
     passphraseStatus = simws.ValidatePassPhrase(this.Domain, this.NewPassphrase);
       }
     if( passphraseStatus != null)
     {
         if( passphraseStatus.statusCode == StatusCodes.PassPhraseInvalid)
         {
             iFolderMsgDialog dialog = new iFolderMsgDialog(
                 null,
                 iFolderMsgDialog.DialogType.Error,
                 iFolderMsgDialog.ButtonSet.None,
                 Util.GS("Invalid Passphrase"),
                 Util.GS("The Current PassPhrase entered is not valid"),
                 Util.GS("Please enter the passphrase again"));
             dialog.Run();
             dialog.Hide();
             dialog.Destroy();
             dialog = null;
             return;
         }
     }
        if( this.RAName != "DEFAULT")
        {
     byte [] RACertificateObj = domainController.GetRACertificate(this.Domain, this.RAName);
     if( RACertificateObj != null && RACertificateObj.Length != 0)
     {
      System.Security.Cryptography.X509Certificates.X509Certificate Cert = new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
      CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
      if (!Util.RegisterModalWindow(dlg))
      {
       dlg.Destroy();
       dlg = null;
       return ;
      }
      int res = dlg.Run();
      dlg.Hide();
      dlg.Destroy();
      dlg = null;
      if( res == (int)ResponseType.Ok)
      {
       publicKey = Convert.ToBase64String(Cert.GetPublicKey());
       Debug.PrintLine(String.Format(" The public key is: {0}", publicKey));
       reset = true;
      }
      else
      {
       reset = false;
       Debug.PrintLine("Response type is not ok");
       return;
      }
     }
        }
        else
        {
      DomainInformation domainInfo = (DomainInformation)this.simws.GetDomainInformation(this.Domain);
             string memberUID = domainInfo.MemberUserID;
             publicKey = this.ifws.GetDefaultServerPublicKey(this.Domain, memberUID);
                 reset = true;
        }
        if( reset == true)
        {
     try
     {
      status = domainController.ReSetPassphrase(this.Domain, this.OldPassphrase, this.NewPassphrase, this.RAName, publicKey);
      simws.StorePassPhrase(this.Domain, "", CredentialType.None, false);
      simws.StorePassPhrase(this.Domain, this.NewPassphrase, CredentialType.Basic, this.SavePassphrase);
     }
     catch(Exception ex)
     {
      throw ex;
     }
        }
        if( status == false)
        {
      iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                                                        null,
                                                                                                        iFolderMsgDialog.DialogType.Error,
                                                                                                         iFolderMsgDialog.ButtonSet.None,
                                                                                                         Util.GS("Change Passphrase"),
                                                                                                         Util.GS("Unable to change the Passphrase"),
                                                                     Util.GS("Please try again"));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     dialog = null;
        }}
        catch(Exception e)
                 {
                         Debug.PrintLine(String.Format("Exception in reset passphrase : {0}",e.Message));
                 }
 }
예제 #5
0
 private bool OnValidateClicked(object o, EventArgs args)
 {
     bool NextPage = true;
        string publicKey = null;
        string memberUID = null;
        iFolderData ifdata = iFolderData.GetData();
        try
        {
     if ( PassPhraseSet ==false )
     {
      if (PassPhraseEntry.Text != PassPhraseVerifyEntry.Text)
      {
       iFolderMsgDialog dialog = new iFolderMsgDialog(
        null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,
        Util.GS("Passphrase mismatch"),
        Util.GS("The passphrase and retyped passphrase are not same"),
        Util.GS("Please enter the passphrase again"));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
        NextPage = false;
      }
      else
      {
       string recoveryAgentName = null;
       TreeSelection tSelect = RATreeView.Selection;
       if(tSelect != null && tSelect.CountSelectedRows() == 1)
       {
        TreeModel tModel;
        TreeIter iter;
        tSelect.GetSelected(out tModel, out iter);
        recoveryAgentName = (string) tModel.GetValue(iter, 0);
       }
       if( recoveryAgentName != null && recoveryAgentName != Util.GS("Server_Default") )
       {
        byte [] RACertificateObj = domainController.GetRACertificate(ConnectedDomain.ID, recoveryAgentName);
        if( RACertificateObj != null && RACertificateObj.Length != 0)
        {
     System.Security.Cryptography.X509Certificates.X509Certificate Cert = new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
     CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
     int res = dlg.Run();
     dlg.Hide();
     dlg.Destroy();
     dlg = null;
     if( res == (int)ResponseType.Ok)
     {
      publicKey = Convert.ToBase64String(Cert.GetPublicKey());
      Debug.PrintLine(String.Format(" The public key is: {0}", publicKey));
     }
     else
     {
      Debug.PrintLine("Response type is not ok");
         simws.StorePassPhrase(ConnectedDomain.ID, "", CredentialType.None, false);
      NextPage = false;
     }
        }
       }
        else
        {
     recoveryAgentName = "DEFAULT";
     DomainInformation domainInfo = (DomainInformation)this.simws.GetDomainInformation(ConnectedDomain.ID);
     memberUID = domainInfo.MemberUserID;
     iFolderWebService ifws = DomainController.GetiFolderService();
     try{
      publicKey = ifws.GetDefaultServerPublicKey(ConnectedDomain.ID,memberUID);
     }
     catch
     {
      return false;
     }
        }
       if( NextPage)
       {
        Status passPhraseStatus = simws.SetPassPhrase (ConnectedDomain.ID, PassPhraseEntry.Text, recoveryAgentName, publicKey);
        if(passPhraseStatus.statusCode == StatusCodes.Success)
        {
     simws.StorePassPhrase( ConnectedDomain.ID, PassPhraseEntry.Text,
      CredentialType.Basic, RememberPassPhraseCheckButton.Active);
     this.passPhraseEntered = true;
     if( this.waitForPassphrase == true)
     {
      if( upload == true)
      {
       return CreateDefaultiFolder();
      }
      else
      {
       return DownloadiFolder();
      }
     }
        }
        else
        {
       iFolderMsgDialog dialog = new iFolderMsgDialog(
         null,
         iFolderMsgDialog.DialogType.Error,
         iFolderMsgDialog.ButtonSet.None,
         Util.GS("Error setting the passphrase"),
         Util.GS("Unable to set the passphrase"),
         Util.GS("Please try again"));
         dialog.Run();
         dialog.Hide();
         dialog.Destroy();
         dialog = null;
         NextPage = false;
        }
       }
      }
     }
     else
     {
      Debug.PrintLine("Validating passphrase");
      Status validationStatus = domainController.ValidatePassPhrase (ConnectedDomain.ID, PassPhraseEntry.Text );
      if (validationStatus.statusCode == StatusCodes.PassPhraseInvalid )
      {
       NextPage = false;
       iFolderMsgDialog dialog = new iFolderMsgDialog(
       null,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.None,
       Util.GS("PassPhrase Invalid"),
       Util.GS("The PassPhrase entered is not valid"),
       Util.GS("Please enter the passphrase again"));
       dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       dialog = null;
      }
      else if(validationStatus.statusCode == StatusCodes.Success )
      {
       Debug.PrintLine("Success. storing passphrase");
       domainController.StorePassPhrase( ConnectedDomain.ID, PassPhraseEntry.Text,
     CredentialType.Basic, RememberPassPhraseCheckButton.Active);
       this.passPhraseEntered = true;
       if( this.waitForPassphrase == true)
       {
        if( upload == true)
        {
     return CreateDefaultiFolder();
        }
        else
        {
     return DownloadiFolder();
        }
       }
      }
     }
        }
        catch (Exception ex)
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
     null,
     iFolderMsgDialog.DialogType.Error,
     iFolderMsgDialog.ButtonSet.None,
     Util.GS("Unable to set the passphrase"),
     Util.GS(ex.Message),
     Util.GS("Please enter the passphrase again"));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     dialog = null;
     NextPage = false;
        }
        if( NextPage == false)
        {
     Debug.PrintLine("In the same page");
     AccountDruid.Page = RAPage;
     return false;
        }
        BackButton.Label = Util.GS("gtk-go-back");
        return true;
 }
 private void OnResetClicked( object o, EventArgs args)
 {
     Debug.PrintLine("Reset clicked");
        string publicKey = null;
        bool reset = false;
        DomainController domainController = DomainController.GetDomainController();
     Status passphraseStatus = simws.ValidatePassPhrase(this.Domain, this.OldPassphrase);
     if( passphraseStatus != null)
     {
         if( passphraseStatus.statusCode == StatusCodes.PassPhraseInvalid)
         {
             iFolderMsgDialog dialog = new iFolderMsgDialog(
                 null,
                 iFolderMsgDialog.DialogType.Error,
                 iFolderMsgDialog.ButtonSet.None,
                 Util.GS("Invalid Passphrase"),
                 Util.GS("The Current PassPhrase entered is not valid"),
                 Util.GS("Please enter the passphrase again"));
             dialog.Run();
             dialog.Hide();
             dialog.Destroy();
             dialog = null;
             return;
         }
     }
        if( this.RAName != null)
        {
     byte [] RACertificateObj = domainController.GetRACertificate(this.Domain, this.RAName);
     if( RACertificateObj != null && RACertificateObj.Length != 0)
     {
      System.Security.Cryptography.X509Certificates.X509Certificate Cert = new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
      CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
      if (!Util.RegisterModalWindow(dlg))
      {
       dlg.Destroy();
       dlg = null;
       return ;
      }
      int res = dlg.Run();
      dlg.Hide();
      dlg.Destroy();
      dlg = null;
      if( res == (int)ResponseType.Ok)
      {
       publicKey = Convert.ToBase64String(Cert.GetPublicKey());
       Debug.PrintLine(String.Format(" The public key is: {0}", publicKey));
       reset = true;
      }
      else
      {
       reset = false;
       Debug.PrintLine("Response type is not ok");
       return;
      }
     }
        }
        else
        {
           iFolderMsgDialog dg = new iFolderMsgDialog(
               this,
               iFolderMsgDialog.DialogType.Warning,
               iFolderMsgDialog.ButtonSet.YesNo,
               "No Recovery Agent",
               Util.GS("Recovery Agent Not Selected"),
               Util.GS("There is no Recovery Agent selected. Encrypted data cannot be recovered later, if passphrase is lost. Do you want to continue?"));
     int rc = dg.Run();
      dg.Hide();
        dg.Destroy();
           if( (ResponseType)rc == ResponseType.Yes )
           {
      reset = true;
           }
           else
           {
      return;
           }
        }
        if( reset == true)
        {
     try
     {
      status = domainController.ReSetPassphrase(this.Domain, this.OldPassphrase, this.NewPassphrase, this.RAName, publicKey);
      simws.StorePassPhrase(this.Domain, "", CredentialType.None, false);
      simws.StorePassPhrase(this.Domain, this.NewPassphrase, CredentialType.Basic, this.SavePassphrase);
     }
     catch(Exception ex)
     {
      throw ex;
     }
        }
        if( status == false)
        {
      iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                                                        null,
                                                                                                        iFolderMsgDialog.DialogType.Error,
                                                                                                         iFolderMsgDialog.ButtonSet.None,
                                                                                                         Util.GS("Reset Passphrase"),
                                                                                                         Util.GS("Unable to change the Passphrase"),
                                                                     Util.GS("Please try again"));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     dialog = null;
        }
 }
예제 #7
0
 private void OnValidateClicked(object o, EventArgs args)
 {
     bool NextPage = true;
        string publicKey = null;
       try {
       if ( !PassPhraseSet )
        {
        if (PassPhraseEntry.Text == PassPhraseVerifyEntry.Text)
     {
      string recoveryAgentName = "";
      TreeSelection tSelect = RATreeView.Selection;
      if(tSelect != null && tSelect.CountSelectedRows() == 1)
      {
       TreeModel tModel;
       TreeIter iter;
       tSelect.GetSelected(out tModel, out iter);
       recoveryAgentName = (string) tModel.GetValue(iter, 0);
       if(recoveryAgentName == Util.GS("None"))
        recoveryAgentName = null;
      }
      if( recoveryAgentName != null && recoveryAgentName != Util.GS("None"))
      {
       byte [] RACertificateObj = domainController.GetRACertificate((domains[domainList.Active]).ID, recoveryAgentName);
       if( RACertificateObj != null && RACertificateObj.Length != 0)
       {
        System.Security.Cryptography.X509Certificates.X509Certificate Cert = new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
        CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
        int res = dlg.Run();
        dlg.Hide();
        dlg.Destroy();
        dlg = null;
        if( res == (int)ResponseType.Ok)
        {
     publicKey = Convert.ToBase64String(Cert.GetPublicKey());
     Debug.PrintLine(String.Format(" The public key is: {0}", publicKey));
        }
        else
        {
     Debug.PrintLine("Response type is not ok");
                             simws.StorePassPhrase((domains[domainList.Active]).ID, "", CredentialType.None, false);
     NextPage = false;
        }
       }
      }
      if( NextPage)
      {
      Status passPhraseStatus = simws.SetPassPhrase ((domains[domainList.Active]).ID, PassPhraseEntry.Text, recoveryAgentName, publicKey);
       if(passPhraseStatus.statusCode == StatusCodes.Success)
       {
        simws.StorePassPhrase( (domains[domainList.Active]).ID, PassPhraseEntry.Text,
     CredentialType.Basic, RememberPassPhraseCheckButton.Active);
       }
       else
       {
      iFolderMsgDialog dialog = new iFolderMsgDialog(
                                          null,
                                          iFolderMsgDialog.DialogType.Error,
                                          iFolderMsgDialog.ButtonSet.None,
                                          Util.GS("Error setting the passphrase"),
                                          Util.GS("Unable to change the Passphrase"),
                                           Util.GS("Please try again"));
                                  dialog.Run();
                                  dialog.Hide();
                                  dialog.Destroy();
                                  dialog = null;
        NextPage = false;
       }
      }
     } else {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
                                        null,
                                        iFolderMsgDialog.DialogType.Error,
                                        iFolderMsgDialog.ButtonSet.None,
                                        Util.GS("Passphrase mismatch"),
                                        Util.GS("The passphrase and retyped passphrase are not same"),
                                        Util.GS("Please enter the passphrase again"));
                                dialog.Run();
                                dialog.Hide();
                                dialog.Destroy();
                                dialog = null;
      NextPage = false;
     }
        } else {
        Status validationStatus = domainController.ValidatePassPhrase ((domains[domainList.Active]).ID, PassPhraseEntry.Text );
     if (validationStatus.statusCode == StatusCodes.PassPhraseInvalid )
     {
      NextPage = false;
        iFolderMsgDialog dialog = new iFolderMsgDialog(
                                        null,
                                        iFolderMsgDialog.DialogType.Error,
                                        iFolderMsgDialog.ButtonSet.None,
                                        Util.GS("PassPhrase Invalid"),
                                        Util.GS("The PassPhrase entered is not valid"),
                                        Util.GS("Please enter the passphrase again"));
                                dialog.Run();
                                dialog.Hide();
                                dialog.Destroy();
                                dialog = null;
     }
     else if(validationStatus.statusCode == StatusCodes.Success )
                          domainController.StorePassPhrase( (domains[domainList.Active]).ID, PassPhraseEntry.Text,
       CredentialType.Basic, RememberPassPhraseCheckButton.Active);
        }
       }
        catch (Exception ex)
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
                                           null,
                                           iFolderMsgDialog.DialogType.Error,
                                           iFolderMsgDialog.ButtonSet.None,
                                           Util.GS("Unable to set the passphrase"),
                                           Util.GS(ex.Message),
                                           Util.GS("Please enter the passphrase again"));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     dialog = null;
     NextPage = false;
       }
        if( NextPage == false)
        {
     Debug.PrintLine("In the same page");
     AccountDruid.Page = UserInformationPage;
        }
 }