Method: PuTTY::Key::OpenSSL::ClassMethods#from_ppk
- Defined in:
- lib/putty/key/openssl.rb
#from_ppk(ppk) ⇒ Object
Creates a new OpenSSL::PKey from a PuTTY private key (instance of
PPK).
This method is called using OpenSSL::PKey.from_ppk(ppk).
PuTTY keys using the algorithms ssh-dss, ssh-rsa,
ecdsa-sha2-nistp256, ecdsa-sha2-nistp384 and ecdsa-sha2-nistp521
are supported.
309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/putty/key/openssl.rb', line 309 def from_ppk(ppk) raise ArgumentError, 'ppk must not be nil' unless ppk case ppk.algorithm when 'ssh-dss' PKeyBuilding.ppk_to_dsa(ppk) when 'ssh-rsa' PKeyBuilding.ppk_to_rsa(ppk) when /\Aecdsa-sha2-(nistp(?:256|384|521))\z/ PKeyBuilding.ppk_to_ec(ppk, $1) else raise ArgumentError, "Unsupported algorithm: #{ppk.algorithm}" end end |