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

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ PubKey

Returns a new instance of PubKey.



27
28
29
# File 'lib/net/ssh/authentication/ed25519.rb', line 27

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

Class Method Details

.read_keyblob(buffer) ⇒ Object



31
32
33
# File 'lib/net/ssh/authentication/ed25519.rb', line 31

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

Instance Method Details

#fingerprintObject



52
53
54
# File 'lib/net/ssh/authentication/ed25519.rb', line 52

def fingerprint
  @fingerprint ||= OpenSSL::Digest::MD5.hexdigest(to_blob).scan(/../).join(":")
end

#ssh_do_verify(sig, data) ⇒ Object



43
44
45
# File 'lib/net/ssh/authentication/ed25519.rb', line 43

def ssh_do_verify(sig,data)
  @verify_key.verify(sig,data)
end

#ssh_typeObject



39
40
41
# File 'lib/net/ssh/authentication/ed25519.rb', line 39

def ssh_type
  "ssh-ed25519"
end

#to_blobObject



35
36
37
# File 'lib/net/ssh/authentication/ed25519.rb', line 35

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

#to_pemObject



47
48
49
50
# File 'lib/net/ssh/authentication/ed25519.rb', line 47

def to_pem
  # TODO this is not pem
  ssh_type + Base64.encode64(@verify_key.to_bytes)
end