traverse(p1) public

If a block is given, it prints out each of the elements encountered. Block parameters are (in that order):

  • depth: The recursion depth, plus one with each constructed value being encountered (Integer)

  • offset: Current byte offset (Integer)

  • header length: Combined length in bytes of the Tag and Length headers. (Integer)

  • length: The overall remaining length of the entire data (Integer)

  • constructed: Whether this value is constructed or not (Boolean)

  • tag_class: Current tag class (Symbol)

  • tag: The current tag number (Integer)

Example

der = File.binread('asn1data.der')
OpenSSL::ASN1.traverse(der) do | depth, offset, header_len, length, constructed, tag_class, tag|
  puts "Depth: #{depth} Offset: #{offset} Length: #{length}"
  puts "Header length: #{header_len} Tag: #{tag} Tag class: #{tag_class} Constructed: #{constructed}"
end
Show source
Register or log in to add new notes.