lib/travis/tools/ssl_key.rb in travis-1.6.18.travis.611.5 vs lib/travis/tools/ssl_key.rb in travis-1.6.18.travis.612.5

- old
+ new

@@ -15,9 +15,22 @@ rescue OpenSSL::PKey::RSAError public_key = string.gsub('RSA PUBLIC KEY', 'PUBLIC KEY') @to_rsa = OpenSSL::PKey::RSA.new(public_key) end + def has_passphrase?(key) + OpenSSL::PKey::RSA.new(key, key) + false + rescue OpenSSL::PKey::RSAError + true + end + + def remove_passphrase(key, passphrase) + OpenSSL::PKey::RSA.new(key, passphrase).to_s + rescue OpenSSL::PKey::RSAError + false + end + def rsa_ssh(key) ['ssh-rsa ', "\0\0\0\assh-rsa#{sized_bytes(key.e)}#{sized_bytes(key.n)}"].pack('a*m').gsub("\n", '') end def sized_bytes(value)