Module: PuTTY::Key::OpenSSL::DSA

Defined in:
lib/putty/key/openssl.rb

Overview

The DSA module is included into OpenSSL::PKey::DSA when using the PuTTY::Key refinement or calling PuTTY::Key.global_install. This adds a to_ppk instance method to OpenSSL::PKey::DSA.

Instance Method Summary collapse

Instance Method Details

#to_ppkPPK

Returns a new PPK instance that is equivalent to this key.

to_ppk can be called on instances of OpenSSL::PKey::DSA.

Returns:

  • (PPK)

    A new instance of PPK that is equivalent to this key.

Raises:



331
332
333
334
335
336
337
338
339
340
341
# File 'lib/putty/key/openssl.rb', line 331

def to_ppk
  PPK.new.tap do |ppk|
    ppk.algorithm = 'ssh-dss'
    begin
      ppk.public_blob = Util.ssh_pack('ssh-dss', p, q, g, pub_key)
      ppk.private_blob = Util.ssh_pack(priv_key)
    rescue NilValueError
      raise InvalidStateError, 'The key has not been fully initialized (the p, q, g, pub_key and priv_key parameters must all be assigned)'
    end
  end
end