Ejemplo n.º 1
0
        public static bool HasSameDataAs(this SshKey key, SshKey otherKey)
        {
            Ensure.ArgumentNotNull(key, "key");

            if (otherKey == null)
            {
                return(false);
            }
            var keyData = key.GetKeyData();

            return(keyData != null && keyData == otherKey.GetKeyData());
        }
Ejemplo n.º 2
0
        public static SshKeyInfo GetKeyDataAndName(this SshKey sshKey)
        {
            Ensure.ArgumentNotNull(sshKey, "sshKey");

            var key = sshKey.Key;

            if (key == null)
            {
                return(null);
            }
            var match = sshKeyRegex.Match(key);

            return(match.Success ? new SshKeyInfo(match.Groups["data"].Value, match.Groups["name"].Value) : null);
        }
Ejemplo n.º 3
0
        static string GetKeyData(this SshKey key)
        {
            var keyInfo = key.GetKeyDataAndName();

            return(keyInfo == null ? null : keyInfo.Data);
        }