public static string SaveKeyPair(SshKeyPair keyPair)
 {
     DirectoryManipulator.CreateNew(EnvironmentVariables.Instance["defaultSSHDirectory"]);
     FileManipulator.SaveFile(EnvironmentVariables.Instance["publicKeyDefaultFilePath"], keyPair.PublicKey);
     FileManipulator.SaveFile(EnvironmentVariables.Instance["privateKeyDefaultFilePath"], keyPair.PrivateKey);
     return(EnvironmentVariables.Instance["publicKeyDefaultFilePath"]);
 }
        public static SshKeyPair CreateSSHKeyPair(string email)
        {
            var keyPair = SshKeyPair.Generate(4096);

            keyPair.AppendEmail(email);
            return(keyPair);
        }
        public static SshKeyPair Generate(int bits)
        {
            SshKey key        = new SshKey();
            int    numBits    = bits;
            int    exponent   = 65537;
            bool   success    = key.GenerateRsaKey(numBits, exponent);
            var    sshKeyPair = new SshKeyPair(key.ToOpenSshPublicKey(), key.ToOpenSshPrivateKey(false));

            if (!success)
            {
                Generate(bits);
            }
            return(sshKeyPair);
        }