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()); }
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); }
static string GetKeyData(this SshKey key) { var keyInfo = key.GetKeyDataAndName(); return(keyInfo == null ? null : keyInfo.Data); }