Esempio n. 1
0
 public void LoadNetworkKeyTypes()
 {
     NetworkKey.RemoveAllItems();
     NetworkKey.AddItem("64-bit");
     NetworkKey.AddItem("128-bit");
     NetworkKey.AddItem("256-bit");
     NetworkKey.AddItem("512-bit");
     NetworkKey.AddItem("1024-bit");
     NetworkKey.AddItem("2048-bit");
 }
Esempio n. 2
0
        ///// <summary>
        ///// Fills network key S2 table with specified keys (Without activating any of them)
        ///// </summary>
        ///// <param name="networkKeys">Keys table</param>
        //public void SetNetworkKeys(NetworkKey[] networkKeys)
        //{
        //    NetworkKey[] keys = networkKeys ?? new NetworkKey[SecurityManagerInfo.NETWORK_KEYS_COUNT];
        //    if (keys.Length != NETWORK_KEYS_COUNT)
        //        throw new ArgumentException("invalid keys table length");


        //    Array.Copy(keys, _networkKeys, NETWORK_KEYS_COUNT);
        //}

        /// <summary>
        /// Sests network key for specified scheme (wihout activating it)
        /// </summary>
        /// <param name="key">Network key</param>
        /// <param name="scheme">scheme</param>
        public void SetNetworkKey(byte[] key, SecuritySchemes scheme)
        {
            var index = GetNetworkKeyIndex(scheme);

            if (_networkKeys[index] == null)
            {
                _networkKeys[index] = new NetworkKey();
            }
            _networkKeys[index].Value = key;
        }
Esempio n. 3
0
        // NETWORK STUFFS

        private void LoadNetworkSettings(bool skipReadFromDevice = false)
        {
            if (!skipReadFromDevice)
            {
                ReadNetworkSettingsFromDevice();
            }

            if (_networkConfig.NetworkMacAddress == null || _networkConfig.NetworkMacAddress.Length == 0)
            {
                OtpManager otpManager = new OtpManager();
                var        settings   = otpManager.GetOtpSettings();

                _networkConfig = new NetworkConfig();
                _networkConfig.NetworkMacAddress = settings.MacAddress;
                _networkConfig.IsWireless        = _selectedDeviceType.IsWirelessCapable;
                SaveNetworkSettings();
                ReadNetworkSettingsFromDevice();
            }

            EnableManualIpSettings(!_networkConfig.EnableDHCP);
            EnableDHCP.State              = _networkConfig.EnableDHCP ? NSCellStateValue.On : NSCellStateValue.Off;
            StaticIPAddress.StringValue   = _networkConfig.StaticIPAddress.ToString();
            SubnetMask.StringValue        = _networkConfig.SubnetMask.ToString();
            DefaultGateway.StringValue    = _networkConfig.DefaultGateway.ToString();
            NetworkMacAddress.StringValue = BitConverter.ToString(_networkConfig.NetworkMacAddress).Replace("-", ":");
            PrimaryDNS.StringValue        = _networkConfig.PrimaryDNS.ToString();
            SecondaryDNS.StringValue      = _networkConfig.SecondaryDNS.ToString();

            EnableWifiSettings();

            if (_networkConfig.IsWireless)
            {
                Authentication.SelectItem(_networkConfig.Authentication);
                Encryption.SelectItem(_networkConfig.Encryption);

                RadioA.State = (_networkConfig.Radio & (int)MFWirelessConfiguration.RadioTypes.a) != 0 ? NSCellStateValue.On : NSCellStateValue.Off;
                RadioB.State = (_networkConfig.Radio & (int)MFWirelessConfiguration.RadioTypes.b) != 0 ? NSCellStateValue.On : NSCellStateValue.Off;
                RadioG.State = (_networkConfig.Radio & (int)MFWirelessConfiguration.RadioTypes.g) != 0 ? NSCellStateValue.On : NSCellStateValue.Off;
                RadioN.State = (_networkConfig.Radio & (int)MFWirelessConfiguration.RadioTypes.n) != 0 ? NSCellStateValue.On : NSCellStateValue.Off;

                Passphrase.StringValue = _networkConfig.Passphrase;
                EncryptConfig.State    = _networkConfig.EncryptConfig ? NSCellStateValue.On : NSCellStateValue.Off;
                int index = (int)Math.Log(_networkConfig.NetworkKeyLength / 8.0, 2);
                NetworkKey.SelectItem(index < NetworkKey.ItemCount && index > 0 ? index : NetworkKey.ItemCount - 1);
                NetworkValue.StringValue  = _networkConfig.NetworkKey;
                ReKeyInternal.StringValue = _networkConfig.ReKeyInternal;
                SSID.StringValue          = _networkConfig.SSID;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (NetworkUpdateButton != null)
            {
                NetworkUpdateButton.Dispose();
                NetworkUpdateButton = null;
            }

            if (Authentication != null)
            {
                Authentication.Dispose();
                Authentication = null;
            }

            if (BootFileLabel != null)
            {
                BootFileLabel.Dispose();
                BootFileLabel = null;
            }

            if (ConfigFileLabel != null)
            {
                ConfigFileLabel.Dispose();
                ConfigFileLabel = null;
            }

            if (DefaultGateway != null)
            {
                DefaultGateway.Dispose();
                DefaultGateway = null;
            }

            if (DeployButton != null)
            {
                DeployButton.Dispose();
                DeployButton = null;
            }

            if (DeviceType != null)
            {
                DeviceType.Dispose();
                DeviceType = null;
            }

            if (EnableDHCP != null)
            {
                EnableDHCP.Dispose();
                EnableDHCP = null;
            }

            if (EncryptConfig != null)
            {
                EncryptConfig.Dispose();
                EncryptConfig = null;
            }

            if (Encryption != null)
            {
                Encryption.Dispose();
                Encryption = null;
            }

            if (FirmwareStatus != null)
            {
                FirmwareStatus.Dispose();
                FirmwareStatus = null;
            }

            if (FlashFileLabel != null)
            {
                FlashFileLabel.Dispose();
                FlashFileLabel = null;
            }

            if (FreeSlots != null)
            {
                FreeSlots.Dispose();
                FreeSlots = null;
            }

            if (MacAddress != null)
            {
                MacAddress.Dispose();
                MacAddress = null;
            }

            if (NetworkKey != null)
            {
                NetworkKey.Dispose();
                NetworkKey = null;
            }

            if (NetworkMacAddress != null)
            {
                NetworkMacAddress.Dispose();
                NetworkMacAddress = null;
            }

            if (NetworkValue != null)
            {
                NetworkValue.Dispose();
                NetworkValue = null;
            }

            if (Output != null)
            {
                Output.Dispose();
                Output = null;
            }

            if (Passphrase != null)
            {
                Passphrase.Dispose();
                Passphrase = null;
            }

            if (PrimaryDNS != null)
            {
                PrimaryDNS.Dispose();
                PrimaryDNS = null;
            }

            if (RadioA != null)
            {
                RadioA.Dispose();
                RadioA = null;
            }

            if (RadioB != null)
            {
                RadioB.Dispose();
                RadioB = null;
            }

            if (RadioG != null)
            {
                RadioG.Dispose();
                RadioG = null;
            }

            if (RadioN != null)
            {
                RadioN.Dispose();
                RadioN = null;
            }

            if (ReKeyInternal != null)
            {
                ReKeyInternal.Dispose();
                ReKeyInternal = null;
            }

            if (SaveConfigurationButton != null)
            {
                SaveConfigurationButton.Dispose();
                SaveConfigurationButton = null;
            }

            if (SecondaryDNS != null)
            {
                SecondaryDNS.Dispose();
                SecondaryDNS = null;
            }

            if (SSID != null)
            {
                SSID.Dispose();
                SSID = null;
            }

            if (StaticIPAddress != null)
            {
                StaticIPAddress.Dispose();
                StaticIPAddress = null;
            }

            if (SubnetMask != null)
            {
                SubnetMask.Dispose();
                SubnetMask = null;
            }

            if (UpdateFirmwareButton != null)
            {
                UpdateFirmwareButton.Dispose();
                UpdateFirmwareButton = null;
            }
        }