summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-25 09:02:03 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-25 09:02:03 +0000
commit9ff4e23741448fb6c02090ebc95671d83b2d03a0 (patch)
tree707407160ee73a3e502e32ece87a5738acd11694
parente271684d2fc7d0d3b6a86a46e2c34c7593dcb35d (diff)
Support OpenSSL 1.1; it supports RSA1024 and DSS1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/openssl/test_x509cert.rb12
-rw-r--r--test/openssl/test_x509req.rb13
2 files changed, 21 insertions, 4 deletions
diff --git a/test/openssl/test_x509cert.rb b/test/openssl/test_x509cert.rb
index 8b88ad4ddd..786eebb368 100644
--- a/test/openssl/test_x509cert.rb
+++ b/test/openssl/test_x509cert.rb
@@ -153,10 +153,18 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
cert.not_after = Time.now
assert_equal(false, cert.verify(@dsa512))
- assert_raise(OpenSSL::X509::CertificateError){
+ begin
cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::Digest::DSS1.new)
- }
+ assert_equal(false, cert.verify(@rsa1024))
+ assert_equal(true, cert.verify(@rsa2048))
+ assert_equal(false, certificate_error_returns_false { cert.verify(@dsa256) })
+ assert_equal(false, certificate_error_returns_false { cert.verify(@dsa512) })
+ cert.subject = @ee1
+ assert_equal(false, cert.verify(@rsa2048))
+ rescue OpenSSL::X509::CertificateError
+ end
+
assert_raise(OpenSSL::X509::CertificateError){
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::Digest::MD5.new)
diff --git a/test/openssl/test_x509req.rb b/test/openssl/test_x509req.rb
index 0ea7cabcee..1b660ca051 100644
--- a/test/openssl/test_x509req.rb
+++ b/test/openssl/test_x509req.rb
@@ -123,8 +123,17 @@ class OpenSSL::TestX509Request < Test::Unit::TestCase
req.public_key = @rsa1024.public_key
assert_equal(false, req.verify(@dsa512))
- assert_raise(OpenSSL::X509::RequestError){
- issue_csr(0, @dn, @rsa1024, OpenSSL::Digest::DSS1.new) }
+ begin
+ req = issue_csr(0, @dn, @rsa1024, OpenSSL::Digest::DSS1.new)
+ assert_equal(true, req.verify(@rsa1024))
+ assert_equal(false, req.verify(@rsa2048))
+ assert_equal(false, request_error_returns_false { req.verify(@dsa256) })
+ assert_equal(false, request_error_returns_false { req.verify(@dsa512) })
+ req.version = 1
+ assert_equal(false, req.verify(@rsa1024))
+ rescue OpenSSL::X509::RequestError
+ end
+
assert_raise(OpenSSL::X509::RequestError){
issue_csr(0, @dn, @dsa512, OpenSSL::Digest::MD5.new) }
end