Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example.rb: Remove key type (
ssh-rsa
) from keys
The key type portion of a `known_hosts` line (`ssh-rsa` or similar) duplicates information already present in the Base 64 encoded string containing the key itself. Thus there's no need for our `KnownHosts` class to require anything but the Base 64 portion of the key. The type was actually ignored, anyway, except for being stripped off before the Base 64 string was decoded and passed to the `Net::SSH::Buffer` class. Thus, we remove this to avoid both unnecessary code and confusion. It's not clear where the idea of prefixing the line with the key type and stripping it off came from; the equivalant code from Net::SSH (`KnownHosts.keys_for()`) has since at least 2.9.4 done a (more proper) parse of SSH `known_hosts` file format with the host names/addresses in front of the key type. Probably when I implemented my version I just dropped the host names without really thinking about what was going on. (`Net::SSH::KnownHosts` class does also check the key type from outside the Base 64 encoded portion of the `known_hosts` line, but it's not clear how useful this really is since it seems just to guess what formats will be known by `Buffer.read_key`.)
- Loading branch information