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.



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

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.



148
149
150
# File 'lib/net/ssh/authentication/ed25519.rb', line 148

def sign_key
  @sign_key
end

Class Method Details

.read(data, password) ⇒ Object



179
180
181
# File 'lib/net/ssh/authentication/ed25519.rb', line 179

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

Instance Method Details

#public_keyObject



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

def public_key
  PubKey.new(@pk)
end

#ssh_do_sign(data, sig_alg = nil) ⇒ Object



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

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

#ssh_signature_typeObject



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

def ssh_signature_type
  ssh_type
end

#ssh_typeObject



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

def ssh_type
  "ssh-ed25519"
end

#to_blobObject



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

def to_blob
  public_key.to_blob
end