Exemple #1
0
		public XSPWebSource(IPAddress address, int port, SecurityProtocolType securityProtocol,
				    X509Certificate cert, PrivateKeySelectionCallback keyCB, 
				    bool allowClientCert, bool requireClientCert, bool single_app)
		{			
			secureConnection = (cert != null && keyCB != null);
			bindAddress = new IPEndPoint (address, port);
			this.securityProtocol = securityProtocol;
			this.cert = cert;
			this.keyCB = keyCB;
			this.allowClientCert = allowClientCert;
			this.requireClientCert = requireClientCert;
		}
Exemple #2
0
 public static bool IsSigned(string filePath)
 {
     if (!File.Exists(filePath)) throw new FileNotFoundException(filePath);
     try
     {
         System.Security.Cryptography.X509Certificates.X509Certificate certificate = new System.Security.Cryptography.X509Certificates.X509Certificate(filePath);
         // An exception would be thrown if the file was not signed
         return true;
     }
     catch (Exception e) { }
     return false;
 }
Exemple #3
0
        public static void Server()
        {
            TcpListener listener = new TcpListener(System.Net.IPAddress.Any, 1300);
            listener.Start();

            // Wait for a client to connect on TCP port 1300
            TcpClient clientSocket = listener.AcceptTcpClient();
            System.Security.Cryptography.X509Certificates.X509Certificate certificate = 
                new System.Security.Cryptography.X509Certificates.X509Certificate("..\\path\\tp\\Certificate.pfx", "ThisPasswordIsTheSameForInstallingTheCertificate");

            // Create a stream to decrypt the data
            using (SslStream sslStream = new SslStream(clientSocket.GetStream()))
            {
                sslStream.AuthenticateAsServer(certificate);
                // ... Send and read data over the stream

                byte[] buffer = System.Text.Encoding.UTF8.GetBytes("_message");
                sslStream.Write(buffer, 0, buffer.Length); 

            }
        }
 private void OnAddDomainCompleted(object o, EventArgs args)
 {
     AddDomainThread addDomainThread = (AddDomainThread)o;
        DomainInformation dom = addDomainThread.Domain;
        string serverName = addDomainThread.ServerName;
        Exception e = addDomainThread.Exception;
        Gdk.Pixbuf certPixbuf1 = new Gdk.Pixbuf(Util.ImagesPath("ifolder-application-x-x509-ca-cert_48.png"));
        if (dom == null && e != null)
        {
     if (e is DomainAccountAlreadyExistsException)
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("An account already exists"),
       Util.GS("An account for this server already exists on the local machine.  Only one account per server is allowed."));
      dg.Run();
      dg.Hide();
      dg.Destroy();
     }
     else
     {
      iFolderMsgDialog dg2 = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("Unable to connect to the iFolder Server"),
       Util.GS("An error was encountered while connecting to the iFolder server.  Please verify the information entered and try again.  If the problem persists, please contact your network administrator."),
       Util.GS(String.Format("Msg {0} \n Stack {1}", e.Message, e.StackTrace)));
      dg2.Run();
      dg2.Hide();
      dg2.Destroy();
     }
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
        }
        if (dom == null)
        {
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
     return;
        }
        switch(dom.StatusCode)
        {
     case StatusCodes.InvalidCertificate:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      serverName = (dom.HostUrl != null) ? dom.HostUrl : addDomainThread.ServerName;
      CertificateProblem certprob;
      byte[] byteArray = simws.GetCertificate2(serverName, out certprob);
      System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
      if(CertPolicy.CertificateProblem.CertEXPIRED.Equals(certprob))
      {
       iFolderMsgDialog dialog1 = new iFolderMsgDialog(
        this,
        iFolderMsgDialog.DialogType.Question,
        iFolderMsgDialog.ButtonSet.YesNo,
        Util.GS("Unable to Verify Identity"),
        Util.GS("Expired!"),
        string.Format(Util.GS("Certificate Expired! for \"{0}\" iFolder server.  You should examine this server's identity certificate carefully.Do you still want to continue?"), serverName),
        cert.ToString(true));
       if (certPixbuf1 != null && dialog1.Image != null)
        dialog1.Image.Pixbuf = certPixbuf1;
       int rc1 = dialog1.Run();
       dialog1.Hide();
       dialog1.Destroy();
       if(rc1 == 8)
       {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Question,
     iFolderMsgDialog.ButtonSet.YesNo,
     Util.GS("Unable to Verify Identity"),
     Util.GS("Accept the certificate of this server?"),
     string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), serverName),
     cert.ToString(true));
        if (certPixbuf1 != null && dialog.Image != null)
     dialog.Image.Pixbuf = certPixbuf1;
        int rc = dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        if(rc == -8)
        {
     if( !(serverName.ToLower()).StartsWith(Uri.UriSchemeHttp))
     {
      serverName = (new Uri( Uri.UriSchemeHttps + Uri.SchemeDelimiter + serverName.TrimEnd( new char[] {'/'}))).ToString();
     }
     else
     {
      UriBuilder ub = new UriBuilder(serverName);
         ub.Scheme = Uri.UriSchemeHttps;
      serverName = ub.ToString();
     }
     ServerNameEntry.Text = string.Copy(serverName);
     simws.StoreCertificate(byteArray, serverName);
     CertAcceptedCond1 = true;
     ServersForCertStore.Add(serverName);
     OnConnectClicked(o, args);
        }
        else
        {
     CertAcceptedCond1 = false;
     simws.RemoveCertFromTable(serverName);
        }
       }
      }
      else
      {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Question,
     iFolderMsgDialog.ButtonSet.YesNo,
     Util.GS("Unable to Verify Identity"),
     Util.GS("Accept the certificate of this server?"),
     string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), serverName),
     cert.ToString(true));
        if (certPixbuf1 != null && dialog.Image != null)
     dialog.Image.Pixbuf = certPixbuf1;
        int rc = dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        if(rc == -8)
        {
     if( !(serverName.ToLower()).StartsWith(Uri.UriSchemeHttp))
     {
      serverName = (new Uri( Uri.UriSchemeHttps + Uri.SchemeDelimiter + serverName.TrimEnd( new char[] {'/'}))).ToString();
     }
     else
     {
      UriBuilder ub = new UriBuilder(serverName);
         ub.Scheme = Uri.UriSchemeHttps;
      serverName = ub.ToString();
     }
     ServerNameEntry.Text = string.Copy(serverName);
     simws.StoreCertificate(byteArray, serverName);
     CertAcceptedCond1 = true;
     ServersForCertStore.Add(serverName);
     OnConnectClicked(o, args);
        }
        else
        {
     CertAcceptedCond1 = false;
     simws.RemoveCertFromTable(serverName);
        }
      }
      break;
     case StatusCodes.Success:
     case StatusCodes.SuccessInGrace:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      string password = addDomainThread.Password;
      bool bRememberPassword = addDomainThread.RememberPassword;
      Status authStatus =
       domainController.AuthenticateDomain(
        dom.ID, password, bRememberPassword);
      if (authStatus != null)
      {
       if (authStatus.statusCode == StatusCodes.Success ||
        authStatus.statusCode == StatusCodes.SuccessInGrace)
       {
        ConnectedDomain = dom;
        if(ServersForCertStore.Count > 1 )
        {
     string serverKey = ServersForCertStore[ServersForCertStore.Count - 2] as string;
     UriBuilder TempServerUri = new UriBuilder(serverKey);
     {
      simws.RemoveCertFromTable(TempServerUri.Host);
     }
        }
        ServersForCertStore.Clear();
        iFolderWebService ifws = DomainController.GetiFolderService();
        int policy = ifws.GetSecurityPolicy(dom.ID);
        if( policy % 2 ==0)
        {
     AccountDruid.Page = SummaryPage;
     AccountDruid.Page = DefaultiFolderPage;
        }
        else
        {
     AccountDruid.Page = RAPage;
     ForwardButton.Sensitive = false;
     AccountDruid.CancelButton.Sensitive = false;
        }
        break;
       }
       else
       {
        Debug.PrintLine("Error while authenticating");
        Util.ShowLoginError(this, authStatus.statusCode);
       }
      }
      else
      {
       Util.ShowLoginError(this, StatusCodes.Unknown);
      }
      if(dom.ID != null)
      {
      }
      break;
     default:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      Util.ShowLoginError(this, dom.StatusCode);
      break;
        }
 }
 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;
        }
 }
		internal static byte[] GetCertificateAssocicationData(TlsaSelector selector, TlsaMatchingType matchingType, X509Certificate certificate)
		{
			byte[] selectedBytes;
			switch (selector)
			{
				case TlsaSelector.FullCertificate:
					selectedBytes = certificate.GetRawCertData();
					break;

				case TlsaSelector.SubjectPublicKeyInfo:
					selectedBytes = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(DotNetUtilities.FromX509Certificate(certificate).GetPublicKey()).GetDerEncoded();
					break;

				default:
					throw new NotSupportedException();
			}

			byte[] matchingBytes;
			switch (matchingType)
			{
				case TlsaMatchingType.Full:
					matchingBytes = selectedBytes;
					break;

				case TlsaMatchingType.Sha256Hash:
					Sha256Digest sha256Digest = new Sha256Digest();
					sha256Digest.BlockUpdate(selectedBytes, 0, selectedBytes.Length);
					matchingBytes = new byte[sha256Digest.GetDigestSize()];
					sha256Digest.DoFinal(matchingBytes, 0);
					break;

				case TlsaMatchingType.Sha512Hash:
					Sha512Digest sha512Digest = new Sha512Digest();
					sha512Digest.BlockUpdate(selectedBytes, 0, selectedBytes.Length);
					matchingBytes = new byte[sha512Digest.GetDigestSize()];
					sha512Digest.DoFinal(matchingBytes, 0);
					break;

				default:
					throw new NotSupportedException();
			}

			return matchingBytes;
		}
 private static bool CheckValidationResult(object Sender, System.Security.Cryptography.X509Certificates.X509Certificate Certificate, System.Security.Cryptography.X509Certificates.X509Chain Chain, System.Net.Security.SslPolicyErrors Errors)
 {
     return(true);
 }
 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;
        }
 }
 public PublisherIdentityPermission( X509Certificate certificate )
 {
     Certificate = certificate;
 }
 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));
                 }
 }
 public virtual System.IAsyncResult BeginAuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, System.AsyncCallback asyncCallback, object asyncState)
 {
     throw null;
 }
 private void DisplayRAName(DomainItem selectedDomain)
 {
     string emailID = null;
     try
     {
         string RAName = this.ifWebService.GetRAName(selectedDomain.ID);
         byte[] CertificateObj = this.simiasWebService.GetRACertificateOnClient(selectedDomain.ID,RAName);
         System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(CertificateObj);
          this.recoveryAgent.Text = RAName;
          emailID = cert.Issuer;
          char[] EmailParser = { '=',',' };
          string[] ParsedString = emailID.Split(EmailParser);
          if (ParsedString != null && ParsedString.Length > 1)
          {
                 for (int x = 0; x < ParsedString.Length; x++)
                 {
                     char[] FinalEmailParser = { '@' };
                     string[] FinalParsedString = ParsedString[x].Split(FinalEmailParser);
                     if (FinalParsedString.Length > 1)
                     {
                         emailAddress = ParsedString[x];
                     }
                 }
             }
         }
      catch (Exception)
     {
     }
 }
 public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
 {
     throw null;
 }
 public virtual System.IAsyncResult BeginAuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, System.AsyncCallback asyncCallback, object asyncState)
 {
     throw null;
 }
 public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate)
 {
     throw null;
 }
 public virtual void AuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
 {
 }
 public virtual void AuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate)
 {
 }
Exemple #18
0
 public bool initialConnect()
 {
     bool result = false;
     bool certPrompt = false;
     try
     {
         SetProxyForDomain(server, true);
         domainInfo = simiasWebService.ConnectToDomain(user, password, server);
         switch (domainInfo.StatusCode)
         {
             case StatusCodes.InvalidCertificate:
                 string serverName = domainInfo.HostUrl != null ? domainInfo.HostUrl : server;
                 byte[] byteArray = simiasWebService.GetCertificate(server);
                 System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
                 if (!autoAccountEnabled || (autoAccountEnabled && promptForInvalidCert))
                     certPrompt = true;
                 if (certPrompt)
                 {
                     if (!autoAccountEnabled)
                     {
                         BeginInvoke(displayMessageDelegate,
                             new object[] { string.Format(resourceManager.GetString("verifyCert"), serverName), resourceManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2 });
                         messageEvent.WaitOne();
                     }
                     else
                     {
                         MyMessageBox mmb = new MyMessageBox(string.Format(resourceManager.GetString("verifyCert"), serverName), resourceManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2);
                         mmb.StartPosition = FormStartPosition.CenterScreen;
                         messageDialogResult = mmb.ShowDialog();
                     }
                     if (messageDialogResult == DialogResult.Yes)
                     {
                         if (!(server.ToLower()).StartsWith(Uri.UriSchemeHttp))
                         {
                             server = (new Uri(Uri.UriSchemeHttps + Uri.SchemeDelimiter + server.TrimEnd(new char[] { '/' }))).ToString();
                         }
                         else
                         {
                             UriBuilder ub = new UriBuilder(server);
                             ub.Scheme = Uri.UriSchemeHttps;
                             server = ub.ToString();
                         }
                         simiasWebService.StoreCertificate(byteArray, server);
                         ServersForCertStore.Add(server);
                         result = initialConnect();
                     }
                     else
                     {
                         simiasWebService.RemoveCertFromTable(server);
                     }
                 }
                 else
                 {
                     if (!(server.ToLower()).StartsWith(Uri.UriSchemeHttp))
                     {
                         server = (new Uri(Uri.UriSchemeHttps + Uri.SchemeDelimiter + server.TrimEnd(new char[] { '/' }))).ToString();
                     }
                     else
                     {
                         UriBuilder ub = new UriBuilder(server);
                         ub.Scheme = Uri.UriSchemeHttps;
                         server = ub.ToString();
                     }
                     simiasWebService.StoreCertificate(byteArray, server);
                     ServersForCertStore.Add(server);
                     result = initialConnect();
                 }
                 break;
             case StatusCodes.Success:
             case StatusCodes.SuccessInGrace:
                 DomainAuthentication domainAuth = new DomainAuthentication("iFolder", domainInfo.ID, password);
                 domainAuth.Authenticate(simiasManager.WebServiceUri, simiasManager.DataPath);
                 domainInfo.Authenticated = true;
                 if (rememberPassword)
                 {
                     try
                     {
                         simiasWebService.SetDomainCredentials(domainInfo.ID, password, CredentialType.Basic);
                     }
                     catch (Exception ex)
                     {
                         if (!autoAccountEnabled)
                         {
                             BeginInvoke(displayMessageDelegate,
                                 new object[] { resourceManager.GetString("savePasswordError"), string.Empty, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 });
                             messageEvent.WaitOne();
                         }
                         else
                         {
                             FormsTrayApp.log.Info("Exception is {0}", ex.Message);
                         }
                     }
                 }
                 ServersForCertStore.Clear();
                 if (defaultServer)
                 {
                     try
                     {
                         simiasWebService.SetDefaultDomain(domainInfo.ID);
                         domainInfo.IsDefault = true;
                     }
                     catch (Exception ex)
                     {
                         if (!autoAccountEnabled)
                         {
                             BeginInvoke(displayMessageDelegate,
                                 new object[] { resourceManager.GetString("setDefaultError"), resourceManager.GetString("accountErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 });
                             messageEvent.WaitOne();
                         }
                         else
                         {
                             FormsTrayApp.log.Info("{0} : {1}", resourceManager.GetString("accountErrorTitle"), resourceManager.GetString("setDefaultError"));
                         }
                     }
                 }
                 if (domainInfo.StatusCode.Equals(StatusCodes.SuccessInGrace) && !autoAccountEnabled)
                 {
                     BeginInvoke(displayMessageDelegate,
                         new object[] { string.Format(resourceManager.GetString("graceLogin"), domainInfo.RemainingGraceLogins),
      resourceManager.GetString("graceLoginTitle"),
      string.Empty,
      MyMessageBoxButtons.OK,
      MyMessageBoxIcon.Information, MyMessageBoxDefaultButton.Button1 });
                     messageEvent.WaitOne();
                 }
                 if (EnterpriseConnect != null)
                 {
                     EnterpriseConnect(this, new DomainConnectEventArgs(domainInfo));
                 }
                 result = true;
                 break;
             case StatusCodes.InvalidCredentials:
             case StatusCodes.InvalidPassword:
             case StatusCodes.UnknownUser:
                 string servername = domainInfo.HostUrl != null ? domainInfo.HostUrl : server;
                 if (!autoAccountEnabled)
                 {
                     BeginInvoke(displayMessageDelegate,
                         new object[] { resourceManager.GetString("failedAuth"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 });
                     messageEvent.WaitOne();
                 }
                 else
                 {
                     if (password != "")
                     {
                         FormsTrayApp.log.Info("{0}:{1} RetCode: {2}", resourceManager.GetString("serverConnectErrorTitle"), resourceManager.GetString("failedAuth"), domainInfo.StatusCode);
                     }
                 }
                 simiasWebService.RemoveCertFromTable(servername);
                 break;
             case StatusCodes.AccountDisabled:
                 if (!autoAccountEnabled)
                 {
                     BeginInvoke(displayMessageDelegate,
                         new object[] { resourceManager.GetString("accountDisabled"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 });
                     messageEvent.WaitOne();
                 }
                 else
                 {
                     FormsTrayApp.log.Info("{0}:{1}", resourceManager.GetString("serverConnectErrorTitle"), resourceManager.GetString("accountDisabled"));
                 }
                 break;
             case StatusCodes.AccountLockout:
                 if (!autoAccountEnabled)
                 {
                     BeginInvoke(displayMessageDelegate,
                         new object[] { resourceManager.GetString("accountLockout"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 });
                     messageEvent.WaitOne();
                 }
                 else
                 {
                     FormsTrayApp.log.Info("{0}:{1}", resourceManager.GetString("serverConnectErrorTitle"), resourceManager.GetString("accountLockout"));
                 }
                 break;
             case StatusCodes.SimiasLoginDisabled:
                 if (!autoAccountEnabled)
                 {
                     BeginInvoke(displayMessageDelegate,
                         new object[] { resourceManager.GetString("iFolderAccountDisabled"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 });
                     messageEvent.WaitOne();
                 }
                 else
                 {
                     FormsTrayApp.log.Info("{0}:{1}", resourceManager.GetString("serverConnectErrorTitle"), resourceManager.GetString("iFolderAccountDisabled"));
                 }
                 break;
             case StatusCodes.UnknownDomain:
                 if (!autoAccountEnabled)
                 {
                     BeginInvoke(displayMessageDelegate,
                         new object[] { resourceManager.GetString("unknownDomain"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 });
                     messageEvent.WaitOne();
                 }
                 else
                 {
                     FormsTrayApp.log.Info("{0}:{1}", resourceManager.GetString("serverConnectErrorTitle"), resourceManager.GetString("unknownDomain"));
                 }
                 break;
             default:
                 if (!autoAccountEnabled)
                 {
                     BeginInvoke(displayMessageDelegate,
                         new object[] { resourceManager.GetString("serverConnectError"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 });
                     messageEvent.WaitOne();
                 }
                 else
                 {
                     FormsTrayApp.log.Info("{0}:{1}", resourceManager.GetString("serverConnectErrorTitle"), resourceManager.GetString("serverConnectError"));
                 }
                 break;
         }
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("logging to old server"))
         {
             MyMessageBox box = new MyMessageBox(resourceManager.GetString("Upgrade.Text"), resourceManager.GetString("Upgrade.Title"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
             box.StartPosition = FormStartPosition.CenterScreen;
             switch (box.ShowDialog())
             {
                 case DialogResult.OK:
                 case DialogResult.Cancel:
                     return false;
             }
         }
         if ((ex.Message.IndexOf("Simias.ExistsException") != -1) ||
             (ex.Message.IndexOf("already exists") != -1))
         {
             if (!autoAccountEnabled)
             {
                 BeginInvoke(displayMessageDelegate,
                     new object[] { resourceManager.GetString("alreadyJoined"), resourceManager.GetString("alreadyJoinedTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Information, MyMessageBoxDefaultButton.Button1 });
                 messageEvent.WaitOne();
             }
             else
             {
                 FormsTrayApp.log.Info("{0}:{1}", resourceManager.GetString("alreadyJoinedTitle"), resourceManager.GetString("alreadyJoined"));
             }
         }
         else if (!httpsConnect && (ex.Message.IndexOf("InvalidOperationException") != -1))
         {
             if (!(server.ToLower()).StartsWith(Uri.UriSchemeHttp))
             {
                 server = (new Uri(Uri.UriSchemeHttps + Uri.SchemeDelimiter + server.TrimEnd(new char[] { '/' }))).ToString();
             }
             else
             {
                 UriBuilder ub = new UriBuilder(server);
                 ub.Scheme = Uri.UriSchemeHttps;
                 server = ub.ToString();
             }
             httpsConnect = true;
             result = initialConnect();
         }
         else
         {
             if (!autoAccountEnabled)
             {
                 BeginInvoke(displayMessageDelegate,
                     new object[] { resourceManager.GetString("serverConnectError"),
                         resourceManager.GetString("serverConnectErrorTitle"),
                         "",
                         MyMessageBoxButtons.OK,
                         MyMessageBoxIcon.Error,
                         MyMessageBoxDefaultButton.Button1
                 });
                 messageEvent.WaitOne();
                 FormsTrayApp.log.Info("{0}:{1}", resourceManager.GetString("serverConnectError"), ex.Message);
             }
             else
             {
                 FormsTrayApp.log.Info("{0}:{1}", resourceManager.GetString("serverConnectErrorTitle"),
                     resourceManager.GetString("serverConnectError"));
             }
         }
     }
     return result;
 }
Exemple #19
0
 /// <summary>
 ///   Creates a new instance of the TlsaRecord class
 /// </summary>
 /// <param name="name"> Domain name of the host </param>
 /// <param name="timeToLive"> Seconds the record should be cached at most </param>
 /// <param name="certificateUsage">The certificate usage</param>
 /// <param name="selector">The selector</param>
 /// <param name="matchingType">The matching type</param>
 /// <param name="certificate">The certificate to get the association data from</param>
 public TlsaRecord(DomainName name, int timeToLive, TlsaCertificateUsage certificateUsage, TlsaSelector selector, TlsaMatchingType matchingType, X509Certificate certificate)
     : base(name, RecordType.Tlsa, RecordClass.INet, timeToLive)
 {
     CertificateUsage           = certificateUsage;
     Selector                   = selector;
     MatchingType               = matchingType;
     CertificateAssociationData = GetCertificateAssocicationData(selector, matchingType, certificate);
 }
Exemple #20
0
 private bool login()
 {
     bool result = false;
        DomainAuthentication domainAuth = new DomainAuthentication("iFolder", domainInfo.ID, password);
     string HostUrl = domainInfo.Host;
        Status authStatus = domainAuth.Authenticate(simiasManager.WebServiceUri, simiasManager.DataPath);
        switch (authStatus.statusCode)
        {
     case StatusCodes.InvalidCertificate:
             if (authStatus.UserName != null)
                 domainInfo.Host = authStatus.UserName;
             byte[] byteArray = simiasWebService.GetCertificate(domainInfo.Host);
      System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
      BeginInvoke( displayMessageDelegate,
                 new object[] { string.Format(resourceManager.GetString("verifyCert"), domainInfo.Host), resourceManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2 });
      messageEvent.WaitOne();
      if ( messageDialogResult == DialogResult.Yes )
      {
                 simiasWebService.StoreCertificate(byteArray, domainInfo.Host);
       result = login();
      }
      break;
     case StatusCodes.Success:
     case StatusCodes.SuccessInGrace:
      result = true;
      if (authStatus.statusCode.Equals(StatusCodes.SuccessInGrace))
      {
       BeginInvoke( displayMessageDelegate,
        new object[] { string.Format(resourceManager.GetString("graceLogin"), authStatus.RemainingGraceLogins),
     resourceManager.GetString("graceLoginTitle"),
     string.Empty,
     MyMessageBoxButtons.OK,
     MyMessageBoxIcon.Information, MyMessageBoxDefaultButton.Button1 } );
       messageEvent.WaitOne();
      }
      if ( updatePasswordPreference )
      {
       try
       {
        if ( rememberPassword )
        {
     simiasWebService.SetDomainCredentials( domainInfo.ID, password, CredentialType.Basic );
        }
        else
        {
     simiasWebService.SetDomainCredentials( domainInfo.ID, null, CredentialType.None );
        }
       }
       catch (Exception ex)
       {
        BeginInvoke( displayMessageDelegate,
     new object[] { resourceManager.GetString("savePasswordError"), string.Empty, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
        messageEvent.WaitOne();
       }
      }
      break;
     case StatusCodes.InvalidCredentials:
     case StatusCodes.InvalidPassword:
     case StatusCodes.UnknownUser:
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("failedAuth"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
     case StatusCodes.AccountDisabled:
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("accountDisabled"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
     case StatusCodes.AccountLockout:
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("accountLockout"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
     case StatusCodes.SimiasLoginDisabled:
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("iFolderAccountDisabled"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
         case StatusCodes.UserAlreadyMoved:
                 result = login();
             break;
     default:
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("serverConnectError"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
        }
        return result;
 }
Exemple #21
0
        internal static byte[] GetCertificateAssocicationData(TlsaSelector selector, TlsaMatchingType matchingType, X509Certificate certificate)
        {
            byte[] selectedBytes;
            switch (selector)
            {
            case TlsaSelector.FullCertificate:
                selectedBytes = certificate.GetRawCertData();
                break;

            case TlsaSelector.SubjectPublicKeyInfo:
                var asymmetricKeyParameter = PublicKeyFactory.CreateKey(certificate.GetRawCertData());
                selectedBytes = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(asymmetricKeyParameter).GetDerEncoded();
                break;

            default:
                throw new NotSupportedException();
            }

            byte[] matchingBytes;
            switch (matchingType)
            {
            case TlsaMatchingType.Full:
                matchingBytes = selectedBytes;
                break;

            case TlsaMatchingType.Sha256Hash:
                Sha256Digest sha256Digest = new Sha256Digest();
                sha256Digest.BlockUpdate(selectedBytes, 0, selectedBytes.Length);
                matchingBytes = new byte[sha256Digest.GetDigestSize()];
                sha256Digest.DoFinal(matchingBytes, 0);
                break;

            case TlsaMatchingType.Sha512Hash:
                Sha512Digest sha512Digest = new Sha512Digest();
                sha512Digest.BlockUpdate(selectedBytes, 0, selectedBytes.Length);
                matchingBytes = new byte[sha512Digest.GetDigestSize()];
                sha512Digest.DoFinal(matchingBytes, 0);
                break;

            default:
                throw new NotSupportedException();
            }

            return(matchingBytes);
        }
 private void OnReLoginDialogResponse(object o, ResponseArgs args)
 {
     switch (args.ResponseId)
        {
     case Gtk.ResponseType.Ok:
      DomainInformation dom = domainController.GetDomain(LoginDialog.Domain);
      if (dom == null)
      {
       iFolderMsgDialog dialog = new iFolderMsgDialog(
        null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,
        Util.GS("Account Error"),
        Util.GS("This account has been removed from your computer."),
        Util.GS("If you wish to connect to this account again, please add it in the Account Settings Dialog."));
       dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       dialog = null;
       LoginDialog.Hide();
       LoginDialog.Destroy();
       LoginDialog = null;
       break;
      }
      try
      {
       string DomainID = LoginDialog.Domain;
       Status status =
        domainController.AuthenticateDomain(
     LoginDialog.Domain,
     LoginDialog.Password,
     LoginDialog.ShouldSavePassword);
       if (status != null)
       {
        switch(status.statusCode)
        {
     case StatusCodes.Success:
     case StatusCodes.SuccessInGrace:
      ifdata.Refresh();
      Debug.PrintLine("Login dialog response- success");
      LoginDialog.Hide();
      LoginDialog.Destroy();
      LoginDialog = null;
       ShowClientUpgradeMessageBox();
                                         int result;
       int policy = ifws.GetSecurityPolicy(DomainID);
       if( policy % 2 == 0)
        break;
                                         bool passphraseStatus = simws.IsPassPhraseSet(DomainID);
       if(passphraseStatus == true)
       {
        bool rememberOption = simws.GetRememberOption(DomainID);
        if( rememberOption == false)
        {
     ShowVerifyDialog( DomainID, simws);
        }
        else
        {
     Debug.PrintLine(" remember Option true. Checking for passphrase existence");
     string passphrasecheck;
     passphrasecheck= simws.GetPassPhrase(DomainID);
     if(passphrasecheck == null || passphrasecheck == "")
      ShowVerifyDialog( DomainID, simws);
        }
       }
       else
       {
        iFolderWindow.ShowEnterPassPhraseDialog(DomainID, simws);
       }
      break;
     case StatusCodes.InvalidCertificate:
      if( status.UserName != null)
      {
       dom.Host = status.UserName;
      }
      byte[] byteArray = simws.GetCertificate(dom.Host);
      System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
      iFolderMsgDialog dialog = new iFolderMsgDialog(
       null,
       iFolderMsgDialog.DialogType.Question,
       iFolderMsgDialog.ButtonSet.YesNo,
       "",
       Util.GS("Accept the certificate of this server?"),
       string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), dom.Host),
       cert.ToString(true));
      Gdk.Pixbuf certPixbuf = Util.LoadIcon("gnome-mime-application-x-x509-ca-cert", 48);
      if (certPixbuf != null && dialog.Image != null)
       dialog.Image.Pixbuf = certPixbuf;
      int rc = dialog.Run();
      dialog.Hide();
      dialog.Destroy();
      if(rc == -8)
      {
       simws.StoreCertificate(byteArray, dom.Host);
       OnReLoginDialogResponse(o, args);
      }
      else
      {
       domainController.DisableDomainAutoLogin(LoginDialog.Domain);
       LoginDialog.Hide();
       LoginDialog.Destroy();
       LoginDialog = null;
      }
      break;
     case StatusCodes.UserAlreadyMoved:
      OnReLoginDialogResponse(o, args);
      break;
     default:
      Util.ShowLoginError(LoginDialog, status.statusCode);
      break;
        }
       }
      }
      catch(Exception e)
      {
       iFolderMsgDialog dialog = new iFolderMsgDialog(
        null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,
        Util.GS("Account Error"),
        Util.GS("Unable to connect to the iFolder Server"),
        Util.GS("An error was encountered while connecting to the iFolder server.  Please verify the information entered and try again.  If the problem persists, please contact your network administrator."),
        e.Message);
       dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       dialog = null;
      }
      break;
     case Gtk.ResponseType.Cancel:
     case Gtk.ResponseType.DeleteEvent:
      domainController.DisableDomainAutoLogin(LoginDialog.Domain);
      LoginDialog.Hide();
      LoginDialog.Destroy();
      LoginDialog = null;
      break;
        }
 }
Exemple #23
0
 public virtual bool Equals(System.Security.Cryptography.X509Certificates.X509Certificate other)
 {
     throw null;
 }
 private void OnDomainLoginCompleted(object o, DomainLoginCompletedArgs args)
 {
     if (WaitDialog != null)
        {
     WaitDialog.Hide();
     WaitDialog.Destroy();
     WaitDialog = null;
        }
        Status authStatus = args.AuthenticationStatus;
        if (authStatus != null)
        {
     switch (authStatus.statusCode)
     {
      case StatusCodes.Success:
      case StatusCodes.SuccessInGrace:
       if (LoginDialog != null)
       {
        LoginDialog.Hide();
        LoginDialog.Destroy();
        LoginDialog = null;
       }
       int result;
       iFolderWebService ifws = DomainController.GetiFolderService();
       int policy = ifws.GetSecurityPolicy(args.DomainID);
       if( policy % 2 == 0)
        break;
       bool passphraseStatus = simws.IsPassPhraseSet(args.DomainID);
       if(passphraseStatus == true)
       {
        bool rememberOption = simws.GetRememberOption(args.DomainID);
        if( rememberOption == false)
        {
     ShowVerifyDialog( args.DomainID, simws);
        }
        else
        {
     Debug.PrintLine(" remember Option true. Checking for passphrase existence");
     string passphrasecheck = simws.GetPassPhrase(args.DomainID);
     if(passphrasecheck == null || passphrasecheck == "")
     {
      Debug.PrintLine("BugBug: Passphrase doesn't exist");
      ShowVerifyDialog( args.DomainID, simws);
     }
        }
       }
       else
       {
        iFolderWindow.ShowEnterPassPhraseDialog(args.DomainID, simws);
       }
       iFolderData ifdata = iFolderData.GetData();
                 ifdata.Refresh();
       UpdateWidgetSensitivity();
       break;
      case StatusCodes.InvalidCertificate:
       DomainInformation dom = domainController.GetDomain(args.DomainID);
       if( authStatus.UserName != null)
       {
        dom.Host = authStatus.UserName;
       }
       byte[] byteArray = simws.GetCertificate(dom.Host);
       System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
       iFolderMsgDialog dialog = new iFolderMsgDialog(
        null,
        iFolderMsgDialog.DialogType.Question,
        iFolderMsgDialog.ButtonSet.YesNo,
        "",
        Util.GS("Accept the certificate of this server?"),
        string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), dom.Host),
        cert.ToString(true));
       Gdk.Pixbuf certPixbuf = Util.LoadIcon("gnome-mime-application-x-x509-ca-cert", 48);
       if (certPixbuf != null && dialog.Image != null)
        dialog.Image.Pixbuf = certPixbuf;
       int rc = dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       if(rc == -8)
       {
        simws.StoreCertificate(byteArray, dom.Host);
        LoginDialog.Respond(Gtk.ResponseType.Ok);
       }
       else
       {
        LoginDialog.Respond(Gtk.ResponseType.Cancel);
       }
       break;
       case StatusCodes.UserAlreadyMoved:
        LoginDialog.Respond(Gtk.ResponseType.Ok);
        break;
      default:
       Util.ShowLoginError(topLevelWindow, authStatus.statusCode);
       if (LoginDialog != null)
        LoginDialog.Present();
       UpdateDomainStatus(args.DomainID);
       break;
     }
        }
        else
        {
     Util.ShowLoginError(topLevelWindow, StatusCodes.Unknown);
     if (LoginDialog != null)
      LoginDialog.Present();
     UpdateDomainStatus(args.DomainID);
        }
        iFolderWindow ifwin = Util.GetiFolderWindow();
        ifwin.UpdateServerInfoForSelectedDomain();
        ifwin.UpdateListViewItems();
 }
Exemple #25
0
 public bool Contains(System.Security.Cryptography.X509Certificates.X509Certificate value)
 {
     throw null;
 }
Exemple #26
0
 bool jc_OnInvalidCertificate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
 {
     Log.DebugFormat("Invalid certificate ({0}):\n{1}", sslPolicyErrors.ToString(), certificate != null ? certificate.ToString(true) : string.Empty);
     return(_untrustedOK);
 }
Exemple #27
0
 public int IndexOf(System.Security.Cryptography.X509Certificates.X509Certificate value)
 {
     throw null;
 }
        private void ServerCertVerify(SSL.Common.Misc.CeriticateInfo ServCertInfo)
        {
            SSL.Common.Misc.ServerCertChainPolicyStatus Reason = ServCertInfo.PolStatus;
            byte[] CertData = ServCertInfo.CertData;

            if(CertData.Length > 0)
            {
                System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(CertData);
            }
        }
Exemple #29
0
 public void Insert(int index, System.Security.Cryptography.X509Certificates.X509Certificate value)
 {
 }
		/// <summary>
		///   Creates a new instance of the TlsaRecord class
		/// </summary>
		/// <param name="name"> Domain name of the host </param>
		/// <param name="timeToLive"> Seconds the record should be cached at most </param>
		/// <param name="certificateUsage">The certificate usage</param>
		/// <param name="selector">The selector</param>
		/// <param name="matchingType">The matching type</param>
		/// <param name="certificate">The certificate to get the association data from</param>
		public TlsaRecord(DomainName name, int timeToLive, TlsaCertificateUsage certificateUsage, TlsaSelector selector, TlsaMatchingType matchingType, X509Certificate certificate)
			: base(name, RecordType.Tlsa, RecordClass.INet, timeToLive)
		{
			CertificateUsage = certificateUsage;
			Selector = selector;
			MatchingType = matchingType;
			CertificateAssociationData = GetCertificateAssocicationData(selector, matchingType, certificate);
		}
Exemple #31
0
 public void Remove(System.Security.Cryptography.X509Certificates.X509Certificate value)
 {
 }
 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;
 }
Exemple #33
0
 bool ISocketEventListener.OnInvalidCertificate(BaseSocket sock, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
 {
     // TODO: pass up the chain
     return(m_listener.OnInvalidCertificate(null, certificate, chain, sslPolicyErrors));
 }
Exemple #34
0
 private bool authenticate()
 {
     bool result = false;
        Cursor.Current = Cursors.WaitCursor;
        try
        {
     DomainAuthentication domainAuth = new DomainAuthentication("iFolder", domainInfo.ID, password.Text);
     Status authStatus = domainAuth.Authenticate(simiasManager.WebServiceUri, simiasManager.DataPath);
     MyMessageBox mmb;
     switch (authStatus.statusCode)
     {
      case StatusCodes.InvalidCertificate:
       byte[] byteArray = simiasWebService.GetCertificate(domainInfo.Host);
       System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
       mmb = new MyMessageBox(string.Format(resourceManager.GetString("verifyCert"), domainInfo.Host), resourceManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2);
       if (mmb.ShowDialog() == DialogResult.Yes)
       {
        simiasWebService.StoreCertificate(byteArray, domainInfo.Host);
        result = authenticate();
       }
       break;
      case StatusCodes.Success:
      case StatusCodes.SuccessInGrace:
       if (authStatus.statusCode.Equals(StatusCodes.SuccessInGrace))
       {
        mmb = new MyMessageBox(
     string.Format(resourceManager.GetString("graceLogin"), authStatus.RemainingGraceLogins),
     resourceManager.GetString("graceLoginTitle"),
     string.Empty,
     MyMessageBoxButtons.OK,
     MyMessageBoxIcon.Information);
        mmb.ShowDialog();
       }
       try
       {
        updateStarted = FormsTrayApp.CheckForClientUpdate(domainInfo.ID);
       }
       catch
       {
       }
       if (rememberPassword.Checked)
       {
        try
        {
     simiasWebService.SetDomainCredentials(domainInfo.ID, password.Text, CredentialType.Basic);
        }
        catch (Exception ex)
        {
     mmb = new MyMessageBox(resourceManager.GetString("savePasswordError"), string.Empty, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
     mmb.ShowDialog();
        }
       }
       result = true;
       break;
      case StatusCodes.InvalidCredentials:
      case StatusCodes.InvalidPassword:
      case StatusCodes.UnknownUser:
       mmb = new MyMessageBox(resourceManager.GetString("badPassword"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
       mmb.ShowDialog();
       break;
      case StatusCodes.AccountDisabled:
       mmb = new MyMessageBox(resourceManager.GetString("accountDisabled"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
       mmb.ShowDialog();
       break;
      case StatusCodes.AccountLockout:
       mmb = new MyMessageBox(resourceManager.GetString("accountLockout"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
       mmb.ShowDialog();
       break;
      case StatusCodes.SimiasLoginDisabled:
       mmb = new MyMessageBox(resourceManager.GetString("iFolderAccountDisabled"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
       mmb.ShowDialog();
       break;
      default:
       mmb = new MyMessageBox(string.Format(resourceManager.GetString("serverReconnectError"), authStatus.statusCode.ToString()), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
       mmb.ShowDialog();
       break;
     }
        }
        catch (Exception ex)
        {
     MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("serverConnectError"), resourceManager.GetString("serverConnectErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
     mmb.ShowDialog();
        }
        Cursor.Current = Cursors.Default;
        return result;
 }
Exemple #35
0
 private Boolean ValidarCertificado(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
 {
     return(true);
 }
Exemple #36
0
 private bool authenticate()
 {
     bool result = false;
        try
        {
     DomainAuthentication domainAuth =
      new DomainAuthentication(
      "iFolder",
      domainInfo.ID,
      null);
     Status status = domainAuth.Authenticate(simiasManager.WebServiceUri, simiasManager.DataPath);
     switch (status.statusCode)
     {
      case StatusCodes.InvalidCertificate:
       byte[] byteArray = simiasWebService.GetCertificate(domainInfo.Host);
       System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
       BeginInvoke( displayMessageDelegate,
        new object[] { string.Format(resourceManager.GetString("verifyCert"), domainInfo.Host), resourceManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2 } );
       messageEvent.WaitOne();
       if ( messageDialogResult == DialogResult.Yes )
       {
        simiasWebService.StoreCertificate(byteArray, domainInfo.Host);
        result = authenticate();
       }
       break;
      case StatusCodes.Success:
       result = true;
       break;
      case StatusCodes.SuccessInGrace:
       BeginInvoke( displayMessageDelegate,
        new object[] { string.Format(resourceManager.GetString("graceLogin"), status.RemainingGraceLogins),
     resourceManager.GetString("graceLoginTitle"),
     string.Empty,
     MyMessageBoxButtons.OK,
     MyMessageBoxIcon.Information, MyMessageBoxDefaultButton.Button1 } );
       messageEvent.WaitOne();
       result = true;
       break;
      default:
      {
       string userID;
       CredentialType credType = simiasWebService.GetDomainCredentials(domainInfo.ID, out userID, out password);
       if ((credType == CredentialType.Basic) && (password != null))
       {
        domainAuth = new DomainAuthentication("iFolder", domainInfo.ID, password);
        Status authStatus = domainAuth.Authenticate(simiasManager.WebServiceUri, simiasManager.DataPath);
        switch (authStatus.statusCode)
        {
     case StatusCodes.Success:
      result = true;
      break;
     case StatusCodes.SuccessInGrace:
      BeginInvoke( displayMessageDelegate,
       new object[] { string.Format(resourceManager.GetString("graceLogin"), status.RemainingGraceLogins),
        resourceManager.GetString("graceLoginTitle"),
        string.Empty,
        MyMessageBoxButtons.OK,
        MyMessageBoxIcon.Information, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      result = true;
      break;
     case StatusCodes.AccountDisabled:
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("accountDisabled"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
     case StatusCodes.AccountLockout:
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("accountLockout"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
     case StatusCodes.SimiasLoginDisabled:
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("iFolderAccountDisabled"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
     case StatusCodes.UnknownUser:
     case StatusCodes.InvalidPassword:
     case StatusCodes.InvalidCredentials:
      simiasWebService.SetDomainCredentials(domainInfo.ID, null, CredentialType.None);
      BeginInvoke( displayMessageDelegate,
       new object[] { resourceManager.GetString("failedAuth"), resourceManager.GetString("serverConnectErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error, MyMessageBoxDefaultButton.Button1 } );
      messageEvent.WaitOne();
      break;
        }
       }
       break;
      }
     }
        }
        catch {}
        return result;
 }
 public bool AcceptAllCertifications(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certification, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
 {
     return(true);
 }
 public static X509.X509Certificate FromX509Certificate(X509Certificate x509Cert)
 {
     return new X509CertificateParser().ReadCertificate(x509Cert.GetRawCertData());
 }
 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");
     }
        }
 }
        //------------------------------------------------------
        //
        // PRIVATE AND PROTECTED HELPERS FOR ACCESSORS AND CONSTRUCTORS
        //
        //------------------------------------------------------

        private static void CheckCertificate( X509Certificate certificate )
        {
            if (certificate == null)
            {
                throw new ArgumentNullException( "certificate" );
            }
            if (certificate.GetRawCertData() == null) {
                throw new ArgumentException(Environment.GetResourceString("Argument_UninitializedCertificate"));
            }
        }
 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;
        }
 }
 private void OnAddDomainCompleted(object o, EventArgs args)
 {
     AddDomainThread addDomainThread = (AddDomainThread)o;
        DomainInformation dom = addDomainThread.Domain;
        Exception e = addDomainThread.Exception;
        if (dom == null && e != null)
        {
     if (e is DomainAccountAlreadyExistsException)
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("An account already exists"),
       Util.GS("An account for this server already exists on the local machine.  Only one account per server is allowed."));
      dg.Run();
      dg.Hide();
      dg.Destroy();
     }
     else
     {
      iFolderMsgDialog dg2 = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("Unable to connect to the iFolder Server"),
       Util.GS("An error was encountered while connecting to the iFolder server.  Please verify the information entered and try again.  If the problem persists, please contact your network administrator."),
       Util.GS(e.Message));
      dg2.Run();
      dg2.Hide();
      dg2.Destroy();
     }
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
        }
        if (dom == null)
        {
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
     return;
        }
        switch(dom.StatusCode)
        {
     case StatusCodes.InvalidCertificate:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      string serverName = addDomainThread.ServerName;
      byte[] byteArray = simws.GetCertificate(serverName);
      System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
      iFolderMsgDialog dialog = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Question,
       iFolderMsgDialog.ButtonSet.YesNo,
       "",
       Util.GS("Accept the certificate of this server?"),
       string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), serverName),
       cert.ToString(true));
      Gdk.Pixbuf certPixbuf = Util.LoadIcon("gnome-mime-application-x-x509-ca-cert", 48);
      if (certPixbuf != null && dialog.Image != null)
       dialog.Image.Pixbuf = certPixbuf;
      int rc = dialog.Run();
      dialog.Hide();
      dialog.Destroy();
      if(rc == -8)
      {
       simws.StoreCertificate(byteArray, serverName);
       OnConnectClicked(o, args);
      }
      break;
     case StatusCodes.Success:
     case StatusCodes.SuccessInGrace:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      string password = addDomainThread.Password;
      bool bRememberPassword = addDomainThread.RememberPassword;
      Status authStatus =
       domainController.AuthenticateDomain(
        dom.ID, password, bRememberPassword);
      if (authStatus != null)
      {
       if (authStatus.statusCode == StatusCodes.Success ||
        authStatus.statusCode == StatusCodes.SuccessInGrace)
       {
        ConnectedDomain = dom;
        AccountDruid.Page = SummaryPage;
        break;
       }
       else
       {
        Util.ShowLoginError(this, authStatus.statusCode);
       }
      }
      else
      {
       Util.ShowLoginError(this, StatusCodes.Unknown);
      }
      break;
     default:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      Util.ShowLoginError(this, dom.StatusCode);
      break;
        }
 }
Exemple #43
0
 private static bool delegateHttpSsl(object obj, System.Security.Cryptography.X509Certificates.X509Certificate c1, System.Security.Cryptography.X509Certificates.X509Chain c2, System.Net.Security.SslPolicyErrors c3)
 {
     return(true);
 }
 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 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;
        }
 }
 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;
 }
Exemple #47
0
 public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)
 {
     return(true);
 }
 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;
        }
 }
Exemple #49
0
 public static AsymmetricKeyParameter GetPublicKeyFromX509Cert(System.Security.Cryptography.X509Certificates.X509Certificate cert)
 {
     return(PublicKeyFactory.CreateKey(cert.GetPublicKey()));
 }