File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ module BERParser
8888 2 => :integer ,
8989 4 => :string ,
9090 5 => :null ,
91- 6 => :string , # (OID)
91+ 6 => :oid ,
9292 10 => :integer ,
9393 13 => :string # (relative OID)
9494 } ,
@@ -147,6 +147,23 @@ def read_ber syntax=nil
147147 j = 0
148148 newobj . each_byte { |b | j = ( j << 8 ) + b }
149149 j
150+ elsif objtype == :oid
151+ # cf X.690 pgh 8.19 for an explanation of this algorithm.
152+ # Potentially not good enough. We may need a BerIdentifiedOid
153+ # as a subclass of BerIdentifiedArray, to get the ber identifier
154+ # and also a to_s method that produces the familiar dotted notation.
155+ oid = newobj . unpack ( "w*" )
156+ f = oid . shift
157+ g = if f < 40
158+ [ 0 , f ]
159+ elsif f < 80
160+ [ 1 , f -40 ]
161+ else
162+ [ 2 , f -80 ] # f-80 can easily be > 80. What a weird optimization.
163+ end
164+ oid . unshift g . last
165+ oid . unshift g . first
166+ oid
150167 elsif objtype == :array
151168 #seq = []
152169 seq = BerIdentifiedArray . new
You can’t perform that action at this time.
0 commit comments