diff options
author | Micah Anderson <micah@riseup.net> | 2017-11-28 11:35:01 -0500 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2017-11-28 11:35:01 -0500 |
commit | 0d251e2ceddd3e02ed8bba8725830689dbdd1397 (patch) | |
tree | 37d7096d9e458ca1e6431dff8a2f571553011c44 /lib/leap_cli/ssh/key.rb | |
parent | 93a181d44e2d8163ae44945aac1b6477e268170d (diff) | |
parent | bf6c56d86c7ba45e7ca766d990a9e9162025e5ac (diff) |
Merge tag 'refs/tags/0.10.0' into stable
Release 0.10.0
Diffstat (limited to 'lib/leap_cli/ssh/key.rb')
-rw-r--r-- | lib/leap_cli/ssh/key.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/leap_cli/ssh/key.rb b/lib/leap_cli/ssh/key.rb index 76223b7e..108b6137 100644 --- a/lib/leap_cli/ssh/key.rb +++ b/lib/leap_cli/ssh/key.rb @@ -254,9 +254,9 @@ module LeapCli end if digest == "MD5" && encoding == :hex - return fp.scan(/../).join(':') + return fp.strip.scan(/../).join(':') else - return fp + return fp.strip end end @@ -267,11 +267,12 @@ module LeapCli Net::SSH::Buffer.from(:key, @key).to_s.split("\001\000").last.size * 8 end - def summary + def summary(type: :ssh, digest: :sha256, encoding: :hex) + fp = digest.to_s.upcase + ":" + self.fingerprint(type: type, digest: digest, encoding: encoding) if self.filename - "%s %s %s (%s)" % [self.type, self.bits, self.fingerprint, File.basename(self.filename)] + "%s %s %s (%s)" % [self.type, self.bits, fp, File.basename(self.filename)] else - "%s %s %s" % [self.type, self.bits, self.fingerprint] + "%s %s %s" % [self.type, self.bits, fp] end end |