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.



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

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.



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

def sign_key
  @sign_key
end

Class Method Details

.read(data, password) ⇒ Object



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

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

Instance Method Details

#public_keyObject



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

def public_key
  PubKey.new(@pk)
end

#ssh_do_sign(data, sig_alg = nil) ⇒ Object



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

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

#ssh_signature_typeObject



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

def ssh_signature_type
  ssh_type
end

#ssh_typeObject



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

def ssh_type
  "ssh-ed25519"
end

#to_blobObject



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

def to_blob
  public_key.to_blob
end