示例#1
0
            int _reNegotiateAfterSeconds = 3600;      //1hr

            #endregion

            #region constructor

            public InternalBitChatService(BitChatService service, BitChatProfile profile, Certificate[] trustedRootCertificates, SecureChannelCryptoOptionFlags supportedCryptoOptions)
            {
                _service = service;
                _profile = profile;
                _trustedRootCertificates = trustedRootCertificates;
                _supportedCryptoOptions  = supportedCryptoOptions;

                _connectionManager = new ConnectionManager(_profile.LocalEP, ChannelRequest);

                LocalPeerDiscovery.StartListener(41733);
                _localDiscovery = new LocalPeerDiscovery(_connectionManager.LocalEP.Port);
                _localDiscovery.PeerDiscovered += _localDiscovery_PeerDiscovered;

                _profile.LocalEP = _connectionManager.LocalEP;
            }
示例#2
0
        public frmSettings(BitChatService service)
        {
            InitializeComponent();

            _service = service;

            BitChatProfile profile = service.Profile;

            txtPort.Text = profile.LocalEP.Port.ToString();
            txtDownloadFolder.Text = profile.DownloadFolder;
            chkUseCRL.Checked = profile.CheckCertificateRevocationList;

            foreach (Uri tracker in profile.TrackerURIs)
            {
                txtTrackers.Text += tracker.AbsoluteUri + "\r\n";
            }

            _timer = new Timer();
            _timer.Interval = 1000;
            _timer.Tick += _timer_Tick;
            _timer.Start();
        }
示例#3
0
            public InternalBitChatService(BitChatService service, BitChatProfile profile, Certificate[] trustedRootCertificates, SecureChannelCryptoOptionFlags supportedCryptoOptions)
            {
                _service = service;
                _profile = profile;
                _trustedRootCertificates = trustedRootCertificates;
                _supportedCryptoOptions = supportedCryptoOptions;

                _connectionManager = new ConnectionManager(_profile.LocalEP, ChannelRequest);

                LocalPeerDiscovery.StartListener(41733);
                _localDiscovery = new LocalPeerDiscovery(_connectionManager.LocalEP.Port);
                _localDiscovery.PeerDiscovered += _localDiscovery_PeerDiscovered;

                _profile.LocalEP = _connectionManager.LocalEP;
            }
示例#4
0
        public frmMain(BitChatProfile profile, string profileFilePath, string cmdLine)
        {
            InitializeComponent();

            _profile = profile;
            _profileFilePath = profileFilePath;

            SecureChannelCryptoOptionFlags cryptoOptions;

            switch (Environment.OSVersion.Platform)
            {
                case PlatformID.Win32NT:
                    if (Environment.OSVersion.Version.Major > 5)
                        cryptoOptions = SecureChannelCryptoOptionFlags.ECDHE256_RSA_WITH_AES256_CBC_HMAC_SHA256 | SecureChannelCryptoOptionFlags.DHE2048_RSA_WITH_AES256_CBC_HMAC_SHA256;
                    else
                        cryptoOptions = SecureChannelCryptoOptionFlags.DHE2048_RSA_WITH_AES256_CBC_HMAC_SHA256;
                    break;

                default:
                    cryptoOptions = SecureChannelCryptoOptionFlags.DHE2048_RSA_WITH_AES256_CBC_HMAC_SHA256;
                    break;
            }

            //start bitchat service
            _service = new BitChatService(profile, Program.TRUSTED_CERTIFICATES, cryptoOptions, InvalidCertificateEvent);
        }
示例#5
0
        private void InvalidCertificateEvent(BitChatService sender, InvalidCertificateException e)
        {
            MessageBox.Show(e.Message, "Invalid Certificate Detected", MessageBoxButtons.OK, MessageBoxIcon.Error);

            this.Hide();
            this.DialogResult = System.Windows.Forms.DialogResult.Ignore;
            this.Close();
        }
示例#6
0
        private void InvalidCertificateEvent(BitChatService sender, InvalidCertificateException e)
        {
            MessageBox.Show(e.Message + "/r/n/r/nClick OK to logout from this Bit Chat profile.", "Invalid Certificate Detected", MessageBoxButtons.OK, MessageBoxIcon.Error);

            notifyIcon1.Visible = false;
            this.Hide();
            this.DialogResult = System.Windows.Forms.DialogResult.Ignore;
            this.Close();
        }