OpenSSL::PKey.read throws a null pointer exception when reading an encrypted key. I found an old Jira entry if it helps.
require 'openssl'
require 'open-uri'
pass = "secure-password!42"
cert = open('https://raw.githubusercontent.com/savonrb/savon/master/spec/fixtures/ssl/client_encrypted_key.pem') {|f| f.read}
r = OpenSSL::PKey.read(cert, pass)