Class: Net::SSH::Authentication::ED25519::PubKey
- Inherits:
-
Object
- Object
- Net::SSH::Authentication::ED25519::PubKey
- Defined in:
- lib/net/ssh/authentication/ed25519.rb
Instance Attribute Summary collapse
-
#verify_key ⇒ Object
readonly
Returns the value of attribute verify_key.
Class Method Summary collapse
Instance Method Summary collapse
- #fingerprint ⇒ Object
-
#initialize(data) ⇒ PubKey
constructor
A new instance of PubKey.
- #ssh_do_verify(sig, data) ⇒ Object
- #ssh_signature_type ⇒ Object
- #ssh_type ⇒ Object
- #to_blob ⇒ Object
- #to_pem ⇒ Object
Constructor Details
#initialize(data) ⇒ PubKey
Returns a new instance of PubKey.
32 33 34 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 32 def initialize(data) @verify_key = RbNaCl::Signatures::Ed25519::VerifyKey.new(data) end |
Instance Attribute Details
#verify_key ⇒ Object (readonly)
Returns the value of attribute verify_key.
30 31 32 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 30 def verify_key @verify_key end |
Class Method Details
.read_keyblob(buffer) ⇒ Object
36 37 38 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 36 def self.read_keyblob(buffer) PubKey.new(buffer.read_string) end |
Instance Method Details
#fingerprint ⇒ Object
61 62 63 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 61 def fingerprint @fingerprint ||= OpenSSL::Digest::MD5.hexdigest(to_blob).scan(/../).join(":") end |
#ssh_do_verify(sig, data) ⇒ Object
52 53 54 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 52 def ssh_do_verify(sig,data) @verify_key.verify(sig,data) end |
#ssh_signature_type ⇒ Object
48 49 50 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 48 def ssh_signature_type ssh_type end |
#ssh_type ⇒ Object
44 45 46 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 44 def ssh_type "ssh-ed25519" end |
#to_blob ⇒ Object
40 41 42 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 40 def to_blob Net::SSH::Buffer.from(:mstring,"ssh-ed25519",:string,@verify_key.to_bytes).to_s end |
#to_pem ⇒ Object
56 57 58 59 |
# File 'lib/net/ssh/authentication/ed25519.rb', line 56 def to_pem # TODO this is not pem ssh_type + Base64.encode64(@verify_key.to_bytes) end |