Sha256: b9d5bc994e988388465128c2636e74f67071e95da1f597f7ca9d79f85d478412

Contents?: true

Size: 656 Bytes

Versions: 6

Compression:

Stored size: 656 Bytes

Contents

module SSLCheck
  module Validators
    class CABundle < GenericValidator
      def validate
        return nil if verified_certificate?
        SSLCheck::Errors::Validation::CABundleVerification.new({:name => "Certificate Authority Verification", :message => "The Certificate could not be verified using the supplied Certificate Authority (CA) Bundle."})
      end

    private
      def verified_certificate?
        return false if @ca_bundle.empty?

        store = OpenSSL::X509::Store.new

        @ca_bundle.each do |ca_cert|
          store.add_cert ca_cert.to_x509
        end

        store.verify(@peer_cert.to_x509)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sslcheck-0.9.4.1 lib/sslcheck/validators/ca_bundle.rb
sslcheck-0.9.4 lib/sslcheck/validators/ca_bundle.rb
sslcheck-0.9.3 lib/sslcheck/validators/ca_bundle.rb
sslcheck-0.9.2 lib/sslcheck/validators/ca_bundle.rb
sslcheck-0.9.1 lib/sslcheck/validators/ca_bundle.rb
sslcheck-0.9.0 lib/sslcheck/validators/ca_bundle.rb