File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,23 @@ def read_ber_from_string str, syntax=nil
252252 j = 0
253253 newobj . each_byte { |b | j = ( j << 8 ) + b }
254254 j
255+ elsif objtype == :oid
256+ # cf X.690 pgh 8.19 for an explanation of this algorithm.
257+ # Potentially not good enough. We may need a BerIdentifiedOid
258+ # as a subclass of BerIdentifiedArray, to get the ber identifier
259+ # and also a to_s method that produces the familiar dotted notation.
260+ oid = newobj . unpack ( "w*" )
261+ f = oid . shift
262+ g = if f < 40
263+ [ 0 , f ]
264+ elsif f < 80
265+ [ 1 , f -40 ]
266+ else
267+ [ 2 , f -80 ] # f-80 can easily be > 80. What a weird optimization.
268+ end
269+ oid . unshift g . last
270+ oid . unshift g . first
271+ oid
255272 elsif objtype == :boolean
256273 newobj != "\000 "
257274 elsif objtype == :null
You can’t perform that action at this time.
0 commit comments