openssl: add missing test for r55219

* test/openssl/test_asn1.rb: Add missing regression test for r55219. It
  fixed the year 2038 issue but the test code was missing.
  [ruby-core:45552] [Bug #6571]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
rhe 2016-05-31 14:10:11 +00:00
Родитель dd1be236d9
Коммит 1978ce784b
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -272,6 +272,14 @@ rEzBQ0F9dUyqQ9gyRg8KHhDfv9HzT1d/rnUZMkoombwYBRIUChGCYV0GnJcan2Zm
assert_equal expected, OpenSSL::ASN1.decode("\x17\r130722232317Z").value
end
def test_encode_utctime_2k38
encoded = OpenSSL::ASN1::UTCTime(2 ** 31 - 1).to_der
assert_equal 2 ** 31 - 1, OpenSSL::ASN1.decode(encoded).value.to_i
encoded = OpenSSL::ASN1::UTCTime(2 ** 31).to_der
assert_equal 2 ** 31, OpenSSL::ASN1.decode(encoded).value.to_i
end
def test_create_inf_length_primitive
expected = %w{ 24 80 04 01 61 00 00 }
raw = [expected.join('')].pack('H*')