sslcheck 0.9.4.1 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/sslcheck.rb CHANGED
@@ -6,6 +6,8 @@ module SSLCheck
6
6
  # Your code goes here...
7
7
  end
8
8
 
9
+ SSL_CHECK_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
10
+
9
11
  require 'sslcheck/certificate'
10
12
  require 'sslcheck/validator'
11
13
  require 'sslcheck/certificate_client'
@@ -11,9 +11,20 @@ module SSLCheck
11
11
  return false if @ca_bundle.empty?
12
12
 
13
13
  store = OpenSSL::X509::Store.new
14
+ store.set_default_paths
15
+
16
+ begin
17
+ store.add_file File.join(SSL_CHECK_ROOT_DIR,'ca-bundle', 'ca-bundle.crt')
18
+ rescue OpenSSL::X509::StoreError
19
+ # If the certificate is already present,
20
+ # we don't really care
21
+ end
14
22
 
15
23
  @ca_bundle.each do |ca_cert|
16
- store.add_cert ca_cert.to_x509
24
+ begin
25
+ store.add_cert ca_cert.to_x509
26
+ rescue OpenSSL::X509::StoreError
27
+ end
17
28
  end
18
29
 
19
30
  store.verify(@peer_cert.to_x509)
@@ -1,3 +1,3 @@
1
1
  module SSLCheck
2
- VERSION = "0.9.4.1"
2
+ VERSION = "0.9.5"
3
3
  end
@@ -15,7 +15,7 @@ module SSLCheck
15
15
  end
16
16
  context "when the certificate cannot be verified by the CA Bundle" do
17
17
  it 'should return errors' do
18
- sut = Validators::CABundle.new("npboards.com", @cert, [Certificate.new(CA_PARENT)])
18
+ sut = Validators::CABundle.new("npboards.com", @cert, [Certificate.new(VALID_CERT)])
19
19
  result = sut.validate
20
20
  expect(result).to be_a SSLCheck::Errors::Validation::CABundleVerification
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sslcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4.1
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clayton Lengel-Zigich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-05 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -112,6 +112,7 @@ files:
112
112
  - acceptance/checking_certificates_spec.rb
113
113
  - acceptance/client_spec.rb
114
114
  - blinky_tests
115
+ - ca-bundle/ca-bundle.crt
115
116
  - lib/sslcheck.rb
116
117
  - lib/sslcheck/certificate.rb
117
118
  - lib/sslcheck/certificate_client.rb