Class: Manticore::Client::CustomTrustStrategy Private

Inherits:
Object
  • Object
show all
Defined in:
lib/manticore/client/trust_strategies.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A CustomTrustStrategy is an org.apache.http.conn.ssl.TrustStrategy defined with a proc that uses Ruby OpenSSL::X509::Certificates

See Also:

  • TrustStrategies::coerce(Proc)

Instance Method Summary collapse

Constructor Details

#initialize(proc) ⇒ CustomTrustStrategy

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CustomTrustStrategy.

See Also:

  • TrustStrategies.coerce(Proc)

86
87
88
89
# File 'lib/manticore/client/trust_strategies.rb', line 86

def initialize(proc)
  fail(ArgumentError, "2-arity proc required") unless proc.arity == 2
  @trust_strategy = proc
end

Instance Method Details

#trusted?(java_chain, type) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

96
97
98
99
100
# File 'lib/manticore/client/trust_strategies.rb', line 96

def trusted?(java_chain, type)
  @trust_strategy.call(java_chain.lazy.map(&CONVERT_JAVA_CERTIFICATE_TO_RUBY), String.new(type))
rescue OpenSSL::X509::CertificateError => e
  raise java_certificate_exception(e)
end