private void btnOk_Click(object sender, System.EventArgs e)
 {
     System.Resources.ResourceManager resManager = new System.Resources.ResourceManager(typeof(Connecting));
        if( this.Passphrase.Text == this.RetypePassphrase.Text)
        {
     string publicKey = null;
     string ragent = null;
     if( this.RecoveryAgentCombo.SelectedItem != null && (string)this.RecoveryAgentCombo.SelectedItem != Resource.GetString("NoneText"))
     {
      byte[] CertificateObj = this.simws.GetRACertificateOnClient(this.DomainID, (string)this.RecoveryAgentCombo.SelectedItem);
      System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(CertificateObj);
      MyMessageBox mmb = new MyMessageBox( string.Format(resManager.GetString("verifyCert"), (string)this.RecoveryAgentCombo.SelectedItem), resManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2);
      DialogResult messageDialogResult = mmb.ShowDialog();
      mmb.Dispose();
      mmb.Close();
      if( messageDialogResult != DialogResult.Yes )
       return;
      else
      {
       ragent = (string)this.RecoveryAgentCombo.SelectedItem;
       publicKey = Convert.ToBase64String(cert.GetPublicKey());
      }
     }
     else
     {
      MyMessageBox mmb = new MyMessageBox( resManager.GetString("NoCertWarning"), resManager.GetString("NoCertTitle"), "", MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2);
      DialogResult messageDialogResult = mmb.ShowDialog();
      mmb.Dispose();
      mmb.Close();
      if( messageDialogResult != DialogResult.Yes )
       return;
     }
     Status passPhraseStatus = null;
     try
     {
      passPhraseStatus = simws.SetPassPhrase( DomainID, this.Passphrase.Text, ragent, publicKey);
     }
     catch(Exception ex)
     {
      MessageBox.Show( Resource.GetString("IsPassphraseSetException")+ex.Message);
     }
     if(passPhraseStatus.statusCode == StatusCodes.Success)
     {
      simws.StorePassPhrase( DomainID, this.Passphrase.Text, CredentialType.Basic, this.savePassphrase.Checked);
             status = true;
      Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("SetPassphraseSuccess"), resourceManager.GetString("$this.Text"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Information);
      mmb.ShowDialog();
      mmb.Dispose();
      this.Dispose();
      this.Close();
     }
     else
     {
      status = false;
      Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("IsPassphraseSetException"), resourceManager.GetString("$this.Text"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
      mmb.ShowDialog();
      mmb.Dispose();
     }
        }
        else
        {
     status = false;
        }
 }
Esempio n. 2
0
 private void btnReset_Click(object sender, System.EventArgs e)
 {
     try
        {
     DomainItem domainItem = (DomainItem)this.DomainComboBox.SelectedItem;
     this.domainID = domainItem.ID;
     System.Resources.ResourceManager resManager = new System.Resources.ResourceManager(typeof(Connecting));
     string publicKey = null;
     string ragent = null;
         Status status = null;
         try
         {
             status = simws.ValidatePassPhrase(this.domainID, this.passPhrase.Text);
       if(status.statusCode == StatusCodes.PassPhraseInvalid)
       {
     status = simws.ValidatePassPhrase(this.domainID, this.newPassphrase.Text);
       }
         }
         catch (Exception ex)
         {
             System.Resources.ResourceManager resMgr = new System.Resources.ResourceManager(typeof(VerifyPassphraseDialog));
             MessageBox.Show(resMgr.GetString("ValidatePPError"), ex.Message);
         }
         if (status.statusCode == StatusCodes.PassPhraseInvalid)
         {
             MessageBox.Show(Resource.GetString("InvalidCurrentPPText") , Resource.GetString("ResetTitle") );
             this.success = false;
             return;
         }
         if (this.recoveryAgentCombo.SelectedItem != null && (string)this.recoveryAgentCombo.SelectedItem != TrayApp.Properties.Resources.serverDefaultRA)
         {
             byte[] CertificateObj = this.simws.GetRACertificateOnClient(this.DomainID, (string)this.recoveryAgentCombo.SelectedItem);
             System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(CertificateObj);
             MyMessageBox mmb = new MyMessageBox(string.Format(resManager.GetString("verifyCert"), (string)this.recoveryAgentCombo.SelectedItem), resManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2);
             DialogResult messageDialogResult = mmb.ShowDialog();
             mmb.Dispose();
             mmb.Close();
             if (messageDialogResult != DialogResult.Yes)
                 return;
             else
             {
                 ragent = (string)this.recoveryAgentCombo.SelectedItem;
                 publicKey = Convert.ToBase64String(cert.GetPublicKey());
             }
         }
         else
         {
             ragent = "DEFAULT";
             DomainInformation domainInfo = (DomainInformation)this.simws.GetDomainInformation(this.DomainID);
             string memberUID = domainInfo.MemberUserID;
             publicKey = this.ifws.GetDefaultServerPublicKey(this.DomainID, memberUID);
         }
     status = this.simws.ReSetPassPhrase(this.DomainID, this.passPhrase.Text , this.newPassphrase.Text, ragent, publicKey);
     if( status.statusCode == StatusCodes.Success)
     {
      simws.StorePassPhrase(this.DomainID, "", CredentialType.None, false);
      simws.StorePassPhrase(this.DomainID, this.newPassphrase.Text, CredentialType.Basic, this.rememberPassphrase.Checked);
      MyMessageBox mb = new MyMessageBox(string.Format(Resource.GetString("ResetSuccess")), Resource.GetString("ResetTitle"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Information);
      mb.ShowDialog();
      mb.Dispose();
      this.success = true;
      this.Dispose();
      this.Close();
     }
     else
     {
      MessageBox.Show(Resource.GetString("ResetError") , Resource.GetString("ResetTitle") );
      this.success = false;
     }
        }
        catch(Exception ex)
        {
     MessageBox.Show(Resource.GetString("ResetError") , Resource.GetString(ex.Message) );
     this.success = false;
        }
 }
Esempio n. 3
0
 private void next_Click(object sender, System.EventArgs e)
 {
     if (currentIndex == (maxPages - 1))
        {
     return;
        }
        System.Resources.ResourceManager resManager = new System.Resources.ResourceManager(typeof(Connecting));
        if( currentIndex == 3 )
        {
     if( this.passphrasePage.Passphrase != this.passphrasePage.RetypePassphrase)
     {
      MessageBox.Show(Resource.GetString("TypeRetypeMisMatch"));
     }
     else
     {
      string publicKey = "";
      string ragent = null;
      if( this.passphrasePage.RecoveryAgent != null && this.passphrasePage.RecoveryAgent != "None")
      {
       byte[] CertificateObj = this.simws.GetRACertificateOnClient(this.identityPage.domain.ID, this.passphrasePage.RecoveryAgent);
       System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(CertificateObj);
       MyMessageBox mmb = new MyMessageBox( string.Format(resManager.GetString("verifyCert"), this.passphrasePage.RecoveryAgent), resManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2);
       DialogResult messageDialogResult = mmb.ShowDialog();
       mmb.Dispose();
       mmb.Close();
       if( messageDialogResult != DialogResult.OK )
        return;
       else
       {
        ragent = this.passphrasePage.RecoveryAgent;
        publicKey = Convert.ToBase64String(cert.GetPublicKey());
       }
      }
      Status passPhraseStatus = null;
      try
      {
       passPhraseStatus = this.simiasWebService.SetPassPhrase( this.identityPage.domain.ID, this.passphrasePage.Passphrase, null, publicKey);
      }
      catch(Exception ex)
      {
       MessageBox.Show( Resource.GetString("IsPassphraseSetException")+ex.Message);
       return;
      }
      if(passPhraseStatus.statusCode == StatusCodes.Success)
      {
       this.simiasWebService.StorePassPhrase( this.identityPage.domain.ID, this.passphrasePage.Passphrase, CredentialType.Basic, this.passphrasePage.RememberPassphrase);
       Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("SetPassphraseSuccess"), "", "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Information);
       mmb.ShowDialog();
       mmb.Dispose();
       this.Dispose();
       this.Close();
      }
      else
      {
       Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("IsPassphraseSetException"), "", "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
       mmb.ShowDialog();
       mmb.Dispose();
       return;
      }
     }
        }
        else if(currentIndex == 4)
        {
     Status passPhraseStatus = null;
     try
     {
      passPhraseStatus = this.simiasWebService.ValidatePassPhrase(this.identityPage.domain.ID, this.passphraseVerifyPage.Passphrase);
     }
     catch(Exception ex)
     {
      MessageBox.Show(resManager.GetString("ValidatePPError"), ex.Message);
      return;
     }
     if( passPhraseStatus != null)
     {
      if( passPhraseStatus.statusCode == StatusCodes.PassPhraseInvalid)
      {
       Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("InvalidPPText"), Resource.GetString("VerifyPP"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
       mmb.ShowDialog();
       mmb.Dispose();
       return;
      }
      else if(passPhraseStatus.statusCode == StatusCodes.Success)
      {
       try
       {
        this.simiasWebService.StorePassPhrase( this.identityPage.domain.ID, this.passphraseVerifyPage.Passphrase, CredentialType.Basic, this.passphraseVerifyPage.RememberPassphrase);
       }
       catch(Exception ex)
       {
        MessageBox.Show("Unable to store Passphrase");
        return;
       }
      }
     }
        }
        int nextIndex = this.pages[currentIndex].ValidatePage(currentIndex);
        if( nextIndex == 4 )
        {
     nextIndex = 5;
        }
        else if( nextIndex == 3)
        {
     if( this.identityPage.Encrypion == false )
     {
      if( this.encryptedOriginal == true )
      {
       MyMessageBox mmb1 = new MyMessageBox(Resource.GetString("EncryptTotext"), Resource.GetString("MigrationAlert"), "", MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Warning, MyMessageBoxDefaultButton.Button1);
       DialogResult res = mmb1.ShowDialog();
       if( res == DialogResult.No )
        nextIndex = currentIndex;
       else
        nextIndex = 5;
      }
      else
       nextIndex = 5;
     }
     else
     {
      try
      {
       string passphrasecheck = this.simiasWebService.GetPassPhrase(this.identityPage.domain.ID);
       if( passphrasecheck!= null && passphrasecheck != "")
       {
        Status status = this.simiasWebService.ValidatePassPhrase(this.identityPage.domain.ID, passphrasecheck);
        if( status != null && status.statusCode == StatusCodes.Success)
        {
     nextIndex = 5;
        }
       }
       else if(this.simiasWebService.IsPassPhraseSet(this.identityPage.domain.ID) == true)
       {
        nextIndex = 4;
       }
      }
      catch(Exception ex)
      {
       MessageBox.Show("Unable to get passphrase. \nLogin to the domain and try again.");
       nextIndex = currentIndex;
      }
     }
        }
        if (nextIndex != currentIndex)
        {
     this.pages[currentIndex].DeactivatePage();
     this.pages[nextIndex].ActivatePage(currentIndex);
     if( nextIndex == 5)
     {
      this.pages[nextIndex].PreviousIndex = 2;
     }
     currentIndex = nextIndex;
     if (currentIndex == (maxPages - 2))
     {
      next.Text = Resource.GetString("MigrateText");
      this.verifyPage.UpdateDetails();
     }
     else if (currentIndex == (maxPages - 1))
     {
      next.DialogResult = DialogResult.OK;
      next.Text = Resource.GetString("FinishText");
     }
        }
 }
Esempio n. 4
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CreateiFolder));
        if( this.Passphrase.Text == this.RetypePassphrase.Text)
        {
     string publicKey = null;
     string ragent = null;
         if (this.RecoveryAgentCombo.SelectedItem != null && (string)this.RecoveryAgentCombo.SelectedItem != resources.GetString("serverDefaultRA"))
         {
             byte[] CertificateObj = this.simws.GetRACertificateOnClient(DomainID, (string)this.RecoveryAgentCombo.SelectedItem);
             System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(CertificateObj);
             MyMessageBox mmb = new MyMessageBox(string.Format(resources.GetString("verifyCert"), (string)this.RecoveryAgentCombo.SelectedItem), resources.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2);
             DialogResult messageDialogResult = mmb.ShowDialog();
             mmb.Dispose();
             mmb.Close();
             if (messageDialogResult != DialogResult.Yes)
                 return;
             else
             {
                 ragent = this.RecoveryAgentCombo.SelectedText;
                 publicKey = Convert.ToBase64String(cert.GetPublicKey());
             }
         }
         else
         {
             ragent = "DEFAULT";
             DomainInformation domainInfo = (DomainInformation)this.simws.GetDomainInformation(this.DomainID);
             string memberUID = domainInfo.MemberUserID;
             publicKey = this.ifws.GetDefaultServerPublicKey(this.DomainID, memberUID);
         }
     Status passPhraseStatus = null;
     try
     {
      passPhraseStatus = simws.SetPassPhrase( DomainID, this.Passphrase.Text, ragent, publicKey);
     }
     catch(Exception ex)
     {
      MessageBox.Show(resources.GetString("ErrorSetPP") + ex.Message);
     }
     if(passPhraseStatus.statusCode == StatusCodes.Success)
     {
      simws.StorePassPhrase( DomainID, this.Passphrase.Text, CredentialType.Basic, this.savePassphrase.Checked);
      string passphr = simws.GetPassPhrase(DomainID);
      this.status= simws.IsPassPhraseSet(DomainID);
      if( status == true)
      {
       Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resources.GetString("SetPPSuccess") , resources.GetString("EnterPPTitle") , "",MyMessageBoxButtons.OK, MyMessageBoxIcon.Information);
       mmb.ShowDialog();
       mmb.Dispose();
       this.Dispose();
       this.Close();
      }
     }
     else
     {
      status = false;
      Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resources.GetString("ErrorSetPP") , resources.GetString("EnterPPTitle") , resources.GetString("TryAgain") , MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
      mmb.ShowDialog();
      mmb.Dispose();
     }
        }
        else
        {
     MessageBox.Show(resources.GetString("PPSDontMatch") );
     status = false;
        }
 }
Esempio n. 5
0
 public bool MigrateFolder()
 {
     DomainItem domain = this.MigrationIdentityPage.domain;
        bool shared = this.MigrationIdentityPage.SSL;
        string encryptionAlgorithm = (this.MigrationIdentityPage.Encrypion) ? "BlowFish" : "" ;
        string destination;
        try
        {
     if(this.MigrationServerPage.MigrationOption == false)
     {
      destination = this.MigrationServerPage.HomeLocation;
      DirectoryInfo dir = new DirectoryInfo(destination);
      if( dir.Exists == false)
      {
       this.verifyPage.CloseWaitDialog();
       MessageBox.Show(Resource.GetString("ErrDirCreate"));
       return false;
      }
      if( this.MigrationServerPage.CopyParentDirectory)
      {
       DirectoryInfo di = new DirectoryInfo(this.location);
       destination = destination+"\\"+di.Name;
       di = new DirectoryInfo(destination);
       if( di.Exists )
       {
        this.verifyPage.CloseWaitDialog();
        MessageBox.Show(Resource.GetString("DirExists"), Resource.GetString("MigrationTitle"), MessageBoxButtons.OK);
        return false;
       }
       else
       {
        try
        {
     di.Create();
        }
        catch(Exception ex)
        {
     this.verifyPage.CloseWaitDialog();
     MessageBox.Show(ex.ToString(), Resource.GetString("ErrDirCreate"), MessageBoxButtons.OK);
     return false;
        }
       }
      }
      if(ifws.CanBeiFolder(destination)== false)
      {
       this.verifyPage.CloseWaitDialog();
       MessageBox.Show(Resource.GetString("CannotBeiFolder"),Resource.GetString("MigrationTitle"),MessageBoxButtons.OK);
       return false;
      }
      if(!CopyDirectory(new DirectoryInfo(location), new DirectoryInfo(destination)))
      {
       this.verifyPage.CloseWaitDialog();
       MessageBox.Show(Resource.GetString("CannotCopy"), Resource.GetString("MigrationTitle"), MessageBoxButtons.OK);
       return false;
      }
     }
     else
     {
      destination = this.location;
      if(ifws.CanBeiFolder(destination)== false)
      {
       this.verifyPage.CloseWaitDialog();
       MessageBox.Show(Resource.GetString("CannotBeiFolder"),Resource.GetString("MigrationTitle"),MessageBoxButtons.OK);
       return false;
      }
     }
     if(shared)
     {
      if( ifws.CreateiFolderInDomain(destination, domain.ID) == null)
      {
       this.verifyPage.CloseWaitDialog();
       MessageBox.Show(Resource.GetString("MigrationConvert"), Resource.GetString("MigrationTitle"), MessageBoxButtons.OK);
       return false;
      }
     }
     else
     {
      string passphrase = this.simiasWebService.GetPassPhrase(this.identityPage.domain.ID);
      if( ifws.CreateiFolderInDomainEncr(destination, domain.ID, false, encryptionAlgorithm, passphrase) == null)
      {
       this.verifyPage.CloseWaitDialog();
       MessageBox.Show(Resource.GetString("MigrationConvert"), Resource.GetString("MigrationTitle"), MessageBoxButtons.OK);
       return false;
      }
     }
        }
        catch(Exception ex)
        {
     this.verifyPage.CloseWaitDialog();
     MessageBox.Show(Resource.GetString("CannotBeiFolder"),Resource.GetString("MigrationTitle"),MessageBoxButtons.OK);
     return false;
        }
        if(this.MigrationServerPage.MigrationOption == true)
        {
     string iFolderRegistryKey = @"Software\Novell iFolder";
     RegistryKey iFolderKey = Registry.LocalMachine.OpenSubKey(iFolderRegistryKey, true);
     try
     {
      iFolderKey.DeleteSubKeyTree(UserName);
     }
     catch(Exception ex)
     {
      this.verifyPage.CloseWaitDialog();
      Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(ex.Message, Resource.GetString("MigrationTitle"),"", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
      mmb.ShowDialog();
      mmb.Close();
     }
        }
        return true;
 }