module HTTPClient::JRubySSLSocket::PEMUtils
Public Class Methods
read_certificate(pem)
click to toggle source
# File lib/httpclient/jruby_ssl_socket.rb, line 286 def self.read_certificate(pem) cert = pem.sub(/.*?-----BEGIN CERTIFICATE-----/m, '').sub(/-----END CERTIFICATE-----.*?/m, '') der = cert.unpack('m*').first cf = CertificateFactory.getInstance('X.509') cf.generateCertificate(ByteArrayInputStream.new(der.to_java_bytes)) end
read_private_key(pem, password)
click to toggle source
# File lib/httpclient/jruby_ssl_socket.rb, line 293 def self.read_private_key(pem, password) if password password = password.unpack('C*').to_java(:char) end PEMInputOutput.read_private_key(InputStreamReader.new(ByteArrayInputStream.new(pem.to_java_bytes)), password) end