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.


145
146
147
148
149
150
151
152
# File 'lib/net/ssh/authentication/ed25519.rb', line 145

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


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

def sign_key
  @sign_key
end

Class Method Details

.read(data, password) ⇒ Object


174
175
176
# File 'lib/net/ssh/authentication/ed25519.rb', line 174

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

Instance Method Details

#public_keyObject


166
167
168
# File 'lib/net/ssh/authentication/ed25519.rb', line 166

def public_key
  PubKey.new(@pk)
end

#ssh_do_sign(data) ⇒ Object


170
171
172
# File 'lib/net/ssh/authentication/ed25519.rb', line 170

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

#ssh_signature_typeObject


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

def ssh_signature_type
  ssh_type
end

#ssh_typeObject


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

def ssh_type
  "ssh-ed25519"
end

#to_blobObject


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

def to_blob
  public_key.to_blob
end