Skip to content

Commit

Permalink
[test] ASN.1 to_der on a singlular wrapped object
Browse files Browse the repository at this point in the history
  • Loading branch information
skunkworker authored and kares committed Apr 11, 2024
1 parent 9130b01 commit ceeacba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/ruby/test_asn1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ceeacba

Please sign in to comment.