~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to test/openssl/test_x509store.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2011-09-24 19:16:17 UTC
  • mfrom: (1.1.8 upstream) (13.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110924191617-o1qz4rcmqjot8zuy
Tags: 1.9.3~rc1-1
* New upstream release: 1.9.3 RC1.
  + Includes load.c fixes. Closes: #639959.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
begin
2
 
  require "openssl"
3
 
  require_relative "utils"
4
 
rescue LoadError
5
 
end
6
 
require "test/unit"
 
1
require_relative "utils"
7
2
 
8
3
if defined?(OpenSSL)
9
4
 
22
17
  def teardown
23
18
  end
24
19
 
 
20
  def test_nosegv_on_cleanup
 
21
    cert  = OpenSSL::X509::Certificate.new
 
22
    store = OpenSSL::X509::Store.new
 
23
    ctx   = OpenSSL::X509::StoreContext.new(store, cert, [])
 
24
    ctx.cleanup
 
25
    ctx.verify
 
26
  end
 
27
 
25
28
  def issue_cert(*args)
26
29
    OpenSSL::TestUtils.issue_cert(*args)
27
30
  end
209
212
    crl2 = issue_crl(revoke_info, 2, now+1800, now+3600, [],
210
213
                     ca1_cert, @rsa2048, OpenSSL::Digest::SHA1.new)
211
214
    store.add_crl(crl1)
212
 
    assert_raise(OpenSSL::X509::StoreError){
213
 
      store.add_crl(crl2) # add CRL issued by same CA twice.
214
 
    }
 
215
    if /0\.9\.8.*-rhel/ =~ OpenSSL::OPENSSL_VERSION
 
216
      # RedHat is distributing a patched version of OpenSSL that allows
 
217
      # multiple CRL for a key (multi-crl.patch)
 
218
      assert_nothing_raised do
 
219
        store.add_crl(crl2) # add CRL issued by same CA twice.
 
220
      end
 
221
    else
 
222
      assert_raise(OpenSSL::X509::StoreError){
 
223
        store.add_crl(crl2) # add CRL issued by same CA twice.
 
224
      }
 
225
    end
215
226
  end
216
227
end
217
228