Module: PuTTY::Key::OpenSSL::RSA

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

Overview

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

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:



386
387
388
389
390
391
392
393
394
395
396
# File 'lib/putty/key/openssl.rb', line 386

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