示例#1
0
        public static string GetAuthorizedKeyString(this ISshKey aKey)
        {
            string result = "";

            switch (aKey.Version)
            {
            case SshVersion.SSH1:
                AsymmetricKeyParameter parameters             = aKey.GetPublicKeyParameters();
                RsaKeyParameters       rsaPublicKeyParameters = (RsaKeyParameters)parameters;
                result = aKey.Size + " " +
                         rsaPublicKeyParameters.Exponent.ToString(10) + " " +
                         rsaPublicKeyParameters.Modulus.ToString(10) + " " +
                         String.Format(aKey.GetMD5Fingerprint().ToHexString()) + " " +
                         aKey.Comment;
                break;

            case SshVersion.SSH2:
                result = PublicKeyAlgorithmExt.GetIdentifierString(aKey.Algorithm) + " " +
                         Convert.ToBase64String(aKey.GetPublicKeyBlob()) + " " +
                         String.Format(aKey.GetMD5Fingerprint().ToHexString()) + " " +
                         aKey.Comment;
                break;

            default:
                result = "# unsuported SshVersion: '" + aKey.Version + "'";
                break;
            }
            return(result);
        }
示例#2
0
 public static bool ConfirmCallback(ISshKey key, Process process)
 {
     var programName = Strings.askConfirmKeyUnknownProcess;
     if (process != null) {
         programName = string.Format("{0} ({1})", process.MainWindowTitle,
             process.ProcessName);
     }
     var result = MessageBox.Show(
         string.Format(Strings.askConfirmKey, programName, key.Comment,
         key.GetMD5Fingerprint().ToHexString()), Util.AssemblyTitle,
         MessageBoxButtons.YesNo, MessageBoxIcon.Question,
         MessageBoxDefaultButton.Button2
     );
     return (result == DialogResult.Yes);
 }
示例#3
0
        public static bool ConfirmCallback(ISshKey key, Process process)
        {
            var programName = Strings.askConfirmKeyUnknownProcess;

            if (process != null)
            {
                programName = string.Format("{0} ({1})", process.MainWindowTitle,
                                            process.ProcessName);
            }
            var result = MessageBox.Show(
                string.Format(Strings.askConfirmKey, programName, key.Comment,
                              key.GetMD5Fingerprint().ToHexString()), Util.AssemblyTitle,
                MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button2, TopMost | SetForeground | SystemModal
                );

            return(result == DialogResult.Yes);
        }