Ejemplo n.º 1
0
 public override object GetValue()
 {
     return(KeyUtils.SupportedAlgorithms
            .Select(x => new HostKey {
         KeyType = x, KeyXml = KeyUtils.GeneratePrivateKey(x)
     })
            .ToList());
 }
Ejemplo n.º 2
0
        public ActionResult ReGenSsh(String conform)
        {
            if (String.Equals(conform, "yes", StringComparison.OrdinalIgnoreCase))
            {
                UserConfiguration.Current.HostKeys.Clear();
                foreach (var type in KeyUtils.SupportedAlgorithms)
                {
                    UserConfiguration.Current.HostKeys.Add(new HostKey {
                        KeyType = type, KeyXml = KeyUtils.GeneratePrivateKey(type)
                    });
                }
                UserConfiguration.Current.Save();

                SshServerConfig.RestartSshServer();

                return(RedirectToAction("Edit"));
            }
            return(View());
        }