summaryrefslogtreecommitdiff
path: root/test/openssl/test_x509cert.rb
diff options
context:
space:
mode:
authorJarek Prokop <jprokop@redhat.com>2022-10-18 09:52:13 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-12-13 18:07:41 +0900
commitce025a5cb4a7aea62629fcf8685e931671a0672d (patch)
tree63ee4d61f2b91dc1cd8e40d8c1ed6095e602544f /test/openssl/test_x509cert.rb
parent764da87ab02d30c578138bdb0f37e7c18f2d4371 (diff)
downloadruby-ce025a5cb4a7aea62629fcf8685e931671a0672d.tar.gz
[ruby/openssl] Use SHA256 instead of SHA1 where needed in tests.
Systems such as RHEL 9 are moving away from SHA1 disabling it completely in default configuration. https://github.com/ruby/openssl/commit/32648da2f6
Diffstat (limited to 'test/openssl/test_x509cert.rb')
-rw-r--r--test/openssl/test_x509cert.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/openssl/test_x509cert.rb b/test/openssl/test_x509cert.rb
index d696b98c0a..64805504de 100644
--- a/test/openssl/test_x509cert.rb
+++ b/test/openssl/test_x509cert.rb
@@ -173,13 +173,14 @@ class OpenSSL::TestX509Certificate < OpenSSL::TestCase
end
def test_sign_and_verify_rsa_sha1
- cert = issue_cert(@ca, @rsa2048, 1, [], nil, nil, digest: "sha1")
+ cert = issue_cert(@ca, @rsa2048, 1, [], nil, nil, digest: "SHA1")
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.serial = 2
assert_equal(false, cert.verify(@rsa2048))
+ rescue OpenSSL::X509::CertificateError # RHEL 9 disables SHA1
end
def test_sign_and_verify_rsa_md5
@@ -229,6 +230,7 @@ class OpenSSL::TestX509Certificate < OpenSSL::TestCase
# SHA1 is allowed from OpenSSL 1.0.0 (0.9.8 requires DSS1)
cert = issue_cert(@ca, @dsa256, 1, [], nil, nil, digest: "sha1")
assert_equal("dsaWithSHA1", cert.signature_algorithm)
+ rescue OpenSSL::X509::CertificateError # RHEL 9 disables SHA1
end
def test_check_private_key