diff --git a/lib/net/ber.rb b/lib/net/ber.rb index 53d7920..fbf6dc9 100644 --- a/lib/net/ber.rb +++ b/lib/net/ber.rb @@ -472,6 +472,16 @@ class Array [code].pack('C') + s.length.to_ber_length_encoding + s end + def to_ber_oid + ary = self.dup + first = ary.shift + raise Net::BER::BerError.new( "invalid OID" ) unless [0,1,2].include?(first) + first = first * 40 + ary.shift + ary.unshift first + oid = ary.pack("w*") + [6, oid.length].pack("CC") + oid + end + end # class Array