Exemplo n.º 1
0
        public void Save()
        {
            Random      rand   = new Random();
            double      d      = rand.NextDouble();
            MFKeyConfig keyCfg = new MFKeyConfig();
            KeyPair     keys   = keyCfg.CreateKeyPair();

            MFConfigHelper cfgHelper = new MFConfigHelper(m_dev);

            m_cfg.Enabled = 1;
            m_cfg.Seed    = (UInt64)((double)UInt64.MaxValue * d);

            unsafe
            {
                fixed(byte *key = m_cfg.PrivateSslKey.SectorKey)
                {
                    for (int i = 0; i < keys.PrivateKey.Length && i < MFKeyConfig.PrivateKeySize; i++)
                    {
                        key[i++] = keys.PrivateKey[i];
                    }
                }
            }

            cfgHelper.WriteConfig(c_CfgName, m_cfg, true);

            cfgHelper.Dispose();
        }
Exemplo n.º 2
0
        public void Save()
        {
            Random      rand    = new Random();
            double      d       = rand.NextDouble();
            MFKeyConfig keyCfg  = new MFKeyConfig();
            KeyPair     keys    = keyCfg.CreateKeyPair();

            MFConfigHelper cfgHelper = new MFConfigHelper(m_dev);

            m_cfg.Enabled = 1;
            m_cfg.Seed = (UInt64)((double)UInt64.MaxValue * d);

            unsafe
            {
                fixed (byte* key = m_cfg.PrivateSslKey.SectorKey)
                {
                    for (int i = 0; i < keys.PrivateKey.Length && i < MFKeyConfig.PrivateKeySize; i++)
                    {
                        key[i++] = keys.PrivateKey[i];
                    }
                }
            }

            cfgHelper.WriteConfig(c_CfgName, m_cfg, true);

            cfgHelper.Dispose();
        }
 public void Save()
 {
     m_cfg.WirelessNetworkCount = 1;
     m_cfg.Enabled = 1;
     m_cfgHelper.WriteConfig(c_CfgName, m_cfg, false);
 }
 public void Save()
 {
     m_cfg.NetworkCount = 1;
     m_cfg.Enabled      = 1;
     m_cfgHelper.WriteConfig(c_CfgName, m_cfg);
 }
Exemplo n.º 5
0
 private void WriteConfiguration(byte[] cfg)
 {
     var config = new MFConfigHelper(_device);
     if (!config.IsValidConfig)
         throw new Exception("Invalid config");
     if (config.IsFirmwareKeyLocked)
         throw new Exception("Firmware locked");
     if (config.IsDeploymentKeyLocked)
         throw new Exception("Deployment locked");
     config.WriteConfig("S4NCFG", cfg);
 }
Exemplo n.º 6
0
 private void SetDeviceId(Guid id)
 {
     var buffer = id.ToByteArray();
     var config = new MFConfigHelper(_device);
     config.WriteConfig("S4NID", buffer);
 }
Exemplo n.º 7
0
 public void Save()
 {
     m_cfgHelper.WriteConfig(c_name, m_cfg);
 }