diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-10 00:54:31 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-10 00:54:31 +0000 |
commit | c7b1a661737b84825a8938367177f5d82438f18a (patch) | |
tree | 14466f45d1c1c8cad4ba460d94d3a19ea8725257 /test | |
parent | 8d7adff3f43b45176667a28ed7ff06639f802e07 (diff) | |
download | ruby-c7b1a661737b84825a8938367177f5d82438f18a.tar.gz ruby-c7b1a661737b84825a8938367177f5d82438f18a.tar.xz ruby-c7b1a661737b84825a8938367177f5d82438f18a.zip |
* ext/openssl/ossl.c (ossl_raise): should use ERR_peek_last_error
to get last error on the current thread. And should report
errors are on the stack while OpenSSL.debug is true.
* ext/openssl/ossl.c (ossl_get_errors): new method for debugging
this library.
* ext/openssl/ossl_ssl.c (ossl_sslctx_set_ciphers): fix error message.
* ext/openssl/ossl_x509req.c (ossl_x509req_set_attributes): get rid
of unused variable.
* ext/openssl/ossl_x509store.c (ossl_x509store_initialize): should
set @time to avoid warning.
* ext/openssl/ossl_x509store.c (ossl_x509store_set_default_paths,
X509_STORE_add_cert, X509_STORE_add_crl): should raise error if
wrapped functions failed.
* test/openssl/test_x509store.rb: add test for errors.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/openssl/test_x509store.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/openssl/test_x509store.rb b/test/openssl/test_x509store.rb index 6696020af..b0fe59726 100644 --- a/test/openssl/test_x509store.rb +++ b/test/openssl/test_x509store.rb @@ -191,6 +191,28 @@ class OpenSSL::TestX509Store < Test::Unit::TestCase assert_equal(OpenSSL::X509::V_ERR_CRL_HAS_EXPIRED, store.error) assert_equal(false, store.verify(ee2_cert)) end + + def test_set_errors + now = Time.now + ca1_cert = issue_cert(@ca1, @rsa2048, 1, now, now+3600, [], + nil, nil, OpenSSL::Digest::SHA1.new) + store = OpenSSL::X509::Store.new + store.add_cert(ca1_cert) + assert_raises(OpenSSL::X509::StoreError){ + store.add_cert(ca1_cert) # add same certificate twice + } + + revoke_info = [] + crl1 = issue_crl(revoke_info, 1, now, now+1800, [], + ca1_cert, @rsa2048, OpenSSL::Digest::SHA1.new) + revoke_info = [ [2, now, 1], ] + crl2 = issue_crl(revoke_info, 2, now+1800, now+3600, [], + ca1_cert, @rsa2048, OpenSSL::Digest::SHA1.new) + store.add_crl(crl1) + assert_raises(OpenSSL::X509::StoreError){ + store.add_crl(crl2) # add CRL issued by same CA twice. + } + end end end |