From ceeacbae1fa0a0b458c13968aed5bb0747a72f57 Mon Sep 17 00:00:00 2001 From: John Bolliger Date: Tue, 15 Aug 2023 14:59:39 -0700 Subject: [PATCH] [test] ASN.1 to_der on a singlular wrapped object --- src/test/ruby/test_asn1.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/ruby/test_asn1.rb b/src/test/ruby/test_asn1.rb index 98b3240d..b9b2cf83 100644 --- a/src/test/ruby/test_asn1.rb +++ b/src/test/ruby/test_asn1.rb @@ -21,6 +21,18 @@ def test_encode_integer assert_equal i, OpenSSL::ASN1.decode(ai.to_der).value end + def test_encode_nested_sequence_to_der + data_sequence = ::OpenSSL::ASN1::Sequence([::OpenSSL::ASN1::Integer(0)]) + asn1 = ::OpenSSL::ASN1::Sequence(data_sequence) + assert_equal "0\x03\x02\x01\x00", asn1.to_der + end + + def test_encode_nested_set_to_der + data_set = ::OpenSSL::ASN1::Set([::OpenSSL::ASN1::Integer(0)]) + asn1 = ::OpenSSL::ASN1::Set(data_set) + assert_equal "1\x03\x02\x01\x00", asn1.to_der + end + def test_encode_nil #Primitives raise TypeError, Constructives NoMethodError