Class: Net::SSH::Authentication::ED25519::PrivKey

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

Constant Summary collapse

CipherFactory =
Net::SSH::Transport::CipherFactory
MBEGIN =
"-----BEGIN OPENSSH PRIVATE KEY-----\n"
MEND =
"-----END OPENSSH PRIVATE KEY-----\n"
MAGIC =
"openssh-key-v1"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buffer) ⇒ PrivKey

Returns a new instance of PrivKey.



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

def initialize(buffer)
  pk = buffer.read_string
  sk = buffer.read_string
  _comment = buffer.read_string

  @pk = pk
  @sign_key = SigningKeyFromFile.new(pk,sk)
end

Instance Attribute Details

#sign_keyObject (readonly)

Returns the value of attribute sign_key.



131
132
133
# File 'lib/net/ssh/authentication/ed25519.rb', line 131

def sign_key
  @sign_key
end

Class Method Details

.read(data, password) ⇒ Object



162
163
164
# File 'lib/net/ssh/authentication/ed25519.rb', line 162

def self.read(data, password)
  OpenSSHPrivateKeyLoader.read(data, password)
end

Instance Method Details

#public_keyObject



154
155
156
# File 'lib/net/ssh/authentication/ed25519.rb', line 154

def public_key
  PubKey.new(@pk)
end

#ssh_do_sign(data) ⇒ Object



158
159
160
# File 'lib/net/ssh/authentication/ed25519.rb', line 158

def ssh_do_sign(data)
  @sign_key.sign(data)
end

#ssh_signature_typeObject



150
151
152
# File 'lib/net/ssh/authentication/ed25519.rb', line 150

def ssh_signature_type
  ssh_type
end

#ssh_typeObject



146
147
148
# File 'lib/net/ssh/authentication/ed25519.rb', line 146

def ssh_type
  "ssh-ed25519"
end

#to_blobObject



142
143
144
# File 'lib/net/ssh/authentication/ed25519.rb', line 142

def to_blob
  public_key.to_blob
end