Skip to content

Commit fad144b

Browse files
author
blackhedd
committed
Supported ASN NULL objects. Kindof trivial but nice for completeness.
1 parent e001f04 commit fad144b

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

lib/net/ber.rb

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def initialize
5050
end
5151
end
5252

53+
class BerIdentifiedNull
54+
attr_accessor :ber_identifier
55+
end
56+
5357
#--
5458
# This condenses our nicely self-documenting ASN hashes down
5559
# to an array for fast lookups.
@@ -78,18 +82,18 @@ module BERParser
7882
TagClasses = [:universal, :application, :context_specific, :private]
7983

8084
BuiltinSyntax = BER.compile_syntax( {
81-
:universal => {
82-
:primitive => {
83-
1 => :boolean,
84-
2 => :integer,
85-
4 => :string,
86-
10 => :integer,
87-
},
88-
:constructed => {
89-
16 => :array,
90-
17 => :array
91-
}
92-
}
85+
:universal => {
86+
:primitive => {
87+
1 => :boolean,
88+
2 => :integer,
89+
4 => :string,
90+
10 => :integer,
91+
},
92+
:constructed => {
93+
16 => :array,
94+
17 => :array
95+
}
96+
}
9397
})
9498

9599
#
@@ -184,6 +188,10 @@ def read_ber syntax=nil
184188
seq
185189
elsif objtype == :boolean
186190
newobj != "\000"
191+
elsif objtype == :null
192+
n = BerIdentifiedNull.new
193+
n.ber_identifier = id
194+
n
187195
else
188196
#raise BerError.new( "unsupported object type: class=#{tagclass}, encoding=#{encoding}, tag=#{tag}" )
189197
raise BerError.new( "unsupported object type: id=#{id}" )

0 commit comments

Comments
 (0)