module HTTPClient::JRubySSLSocket::PEMUtils
Public Class Methods
read_certificate(pem)
click to toggle source
# File lib/httpclient/jruby_ssl_socket.rb, line 269 def self.read_certificate(pem) pem = pem.sub(/-----BEGIN CERTIFICATE-----/, '').sub(/-----END CERTIFICATE-----/, '') der = pem.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 276 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