Class: Net::SSH::Authentication::ED25519::PubKey
- Inherits:
-
Object
- Object
- Net::SSH::Authentication::ED25519::PubKey
show all
- Includes:
- PubKeyFingerprint
- Defined in:
- lib/net/ssh/authentication/ed25519.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#fingerprint, fingerprint
Constructor Details
#initialize(data) ⇒ PubKey
Returns a new instance of PubKey.
181
182
183
184
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 181
def initialize(data)
ED25519.validate_key_bytes!(data, "public key", KEY_BYTES)
@public_key_bytes = data.dup.force_encoding('BINARY')
end
|
Class Method Details
.read_keyblob(buffer) ⇒ Object
186
187
188
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 186
def self.read_keyblob(buffer)
PubKey.new(buffer.read_string)
end
|
Instance Method Details
#public_key_bytes ⇒ Object
211
212
213
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 211
def public_key_bytes
@public_key_bytes.dup
end
|
#ssh_do_verify(sig, data, options = {}) ⇒ Object
202
203
204
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 202
def ssh_do_verify(sig, data, options = {})
ED25519.verify(verify_key, sig, data)
end
|
#ssh_signature_type ⇒ Object
198
199
200
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 198
def ssh_signature_type
ssh_type
end
|
#ssh_type ⇒ Object
194
195
196
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 194
def ssh_type
"ssh-ed25519"
end
|
#to_blob ⇒ Object
190
191
192
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 190
def to_blob
Net::SSH::Buffer.from(:mstring, "ssh-ed25519".dup, :string, public_key_bytes).to_s
end
|
#to_pem ⇒ Object
206
207
208
209
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 206
def to_pem
ssh_type + [public_key_bytes].pack("m")
end
|
#verify_key ⇒ Object
215
216
217
|
# File 'lib/net/ssh/authentication/ed25519.rb', line 215
def verify_key
@verify_key ||= ED25519.new_public_key(@public_key_bytes)
end
|