class HTTPClient::JRubySSLSocket::TrustStoreLoader
Attributes
size[R]
Public Class Methods
new()
click to toggle source
# File lib/httpclient/jruby_ssl_socket.rb, line 309 def initialize @trust_store = KeyStore.getInstance('JKS') @trust_store.load(nil) @size = 0 end
Public Instance Methods
add(file_or_dir)
click to toggle source
# File lib/httpclient/jruby_ssl_socket.rb, line 315 def add(file_or_dir) return if file_or_dir == :default if File.directory?(file_or_dir) warn("#{file_or_dir}: directory not yet supported") else pem = nil File.read(file_or_dir).each_line do |line| case line when /-----BEGIN CERTIFICATE-----/ pem = '' when /-----END CERTIFICATE-----/ cert = PEMUtils.read_certificate(pem) @size += 1 @trust_store.setCertificateEntry("cert_#{@size}", cert) else if pem pem << line end end end end end
trust_store()
click to toggle source
# File lib/httpclient/jruby_ssl_socket.rb, line 338 def trust_store if @size == 0 nil else @trust_store end end