# File lib/net/ber.rb, line 49 def to_ber # Provisional implementation. # We ASSUME that our incoming value is an array, and we # use the Array#to_ber_oid method defined below. # We probably should obsolete that method, actually, in # and move the code here. # WE ARE NOT CURRENTLY ENCODING THE BER-IDENTIFIER. # This implementation currently hardcodes 6, the universal OID tag. ary = @value.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