Class: Net::SSH::Authentication::ED25519::PubKey

Inherits:
Object
  • Object
show all
Includes:
PubKeyFingerprint
Defined in:
lib/net/ssh/authentication/ed25519.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PubKeyFingerprint

#fingerprint, fingerprint

Constructor Details

#initialize(data) ⇒ PubKey

Returns a new instance of PubKey.



109
110
111
# File 'lib/net/ssh/authentication/ed25519.rb', line 109

def initialize(data)
  @verify_key = ::Ed25519::VerifyKey.new(data)
end

Instance Attribute Details

#verify_keyObject (readonly)

Returns the value of attribute verify_key.



107
108
109
# File 'lib/net/ssh/authentication/ed25519.rb', line 107

def verify_key
  @verify_key
end

Class Method Details

.read_keyblob(buffer) ⇒ Object



113
114
115
# File 'lib/net/ssh/authentication/ed25519.rb', line 113

def self.read_keyblob(buffer)
  PubKey.new(buffer.read_string)
end

Instance Method Details

#ssh_do_verify(sig, data, options = {}) ⇒ Object



129
130
131
# File 'lib/net/ssh/authentication/ed25519.rb', line 129

def ssh_do_verify(sig, data, options = {})
  @verify_key.verify(sig, data)
end

#ssh_signature_typeObject



125
126
127
# File 'lib/net/ssh/authentication/ed25519.rb', line 125

def ssh_signature_type
  ssh_type
end

#ssh_typeObject



121
122
123
# File 'lib/net/ssh/authentication/ed25519.rb', line 121

def ssh_type
  "ssh-ed25519"
end

#to_blobObject



117
118
119
# File 'lib/net/ssh/authentication/ed25519.rb', line 117

def to_blob
  Net::SSH::Buffer.from(:mstring, "ssh-ed25519".dup, :string, @verify_key.to_bytes).to_s
end

#to_pemObject



133
134
135
136
# File 'lib/net/ssh/authentication/ed25519.rb', line 133

def to_pem
  # TODO this is not pem
  ssh_type + [@verify_key.to_bytes].pack("m")
end