mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl/ossl_digest.c: fix error for digests that have no oid
(e.g. DSS1). * test/openssl/test_digest.c: add tests for this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
60947ded03
commit
1c629eff85
3 changed files with 24 additions and 3 deletions
|
@ -56,6 +56,18 @@ class OpenSSL::TestDigest < Test::Unit::TestCase
|
|||
assert_equal(dig1, dig2, "reset")
|
||||
end
|
||||
|
||||
def test_digest_constants
|
||||
algs = %w(DSS1 MD4 MD5 MDC2 RIPEMD160 SHA SHA1)
|
||||
if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00908000
|
||||
algs += %w(SHA224 SHA256 SHA384 SHA512)
|
||||
end
|
||||
algs.each do |alg|
|
||||
assert_not_nil(OpenSSL::Digest.new(alg))
|
||||
klass = OpenSSL::Digest.const_get(alg)
|
||||
assert_not_nil(klass.new)
|
||||
end
|
||||
end
|
||||
|
||||
def test_digest_by_oid_and_name
|
||||
check_digest(OpenSSL::ASN1::ObjectId.new("MD5"))
|
||||
check_digest(OpenSSL::ASN1::ObjectId.new("SHA1"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue