We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b6ba50 commit 725edfcCopy full SHA for 725edfc
lib/openssl/asn1.rb
@@ -333,11 +333,27 @@ class BMPString < Primitive
333
334
class ObjectId < Primitive
335
def der_value
336
- value = oid.split(".").map(&:to_i)
+ value = oid
337
338
- return (40 * value[0]).chr if value.length == 1
+ dot_index = value.index(".")
339
340
- [value[0] * 40 + value[1], *value[2..]].pack("w*")
+ if dot_index == value.size - 1
341
+ return (value.to_i * 40).chr
342
+ else
343
+ codes = [value.byteslice(0..dot_index-1).to_i * 40]
344
+ end
345
+
346
+ add_to_top = false
347
+ value.byteslice(dot_index+1..-1).split(".") do |sub|
348
+ if add_to_top
349
+ codes << sub.to_i
350
351
+ codes[0] += sub.to_i
352
+ add_to_top = true
353
354
355
356
+ codes.pack("w*")
357
end
358
359
0 commit comments