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.



148
149
150
151
152
153
154
155
# File 'lib/net/ssh/authentication/ed25519.rb', line 148

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.



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

def sign_key
  @sign_key
end

Class Method Details

.read(data, password) ⇒ Object



177
178
179
# File 'lib/net/ssh/authentication/ed25519.rb', line 177

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

Instance Method Details

#public_keyObject



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

def public_key
  PubKey.new(@pk)
end

#ssh_do_sign(data, sig_alg = nil) ⇒ Object



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

def ssh_do_sign(data, sig_alg = nil)
  @sign_key.sign(data)
end

#ssh_signature_typeObject



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

def ssh_signature_type
  ssh_type
end

#ssh_typeObject



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

def ssh_type
  "ssh-ed25519"
end

#to_blobObject



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

def to_blob
  public_key.to_blob
end