Skip to content

Commit

Permalink
to_der on ASN1Data should convert ruby strings into java strings befo…
Browse files Browse the repository at this point in the history
…re encoding
  • Loading branch information
HoneyryderChuck committed Aug 21, 2022
1 parent 1f95043 commit 14b06b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/ruby/test_asn1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ def test_encode_integer
assert_equal i, OpenSSL::ASN1.decode(ai.to_der).value
end

def test_encode_asn1_data
ai = OpenSSL::ASN1::ASN1Data.new(i = "bla", 0, :APPLICATION)
assert_equal i, OpenSSL::ASN1.decode(ai.to_der).value

ai = OpenSSL::ASN1::ASN1Data.new(i = ["bla"], 0, :APPLICATION)
assert_equal i, OpenSSL::ASN1.decode(ai.to_der).value

assert_raise(TypeError) { OpenSSL::ASN1::ASN1Data.new(1).to_der }
end

def test_encode_nil
#Primitives raise TypeError, Constructives NoMethodError

Expand Down

0 comments on commit 14b06b0

Please sign in to comment.