Skip to content

Commit 5938f5e

Browse files
move indefinite length check to implementation
1 parent 66ba7f6 commit 5938f5e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/openssl/asn1.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,8 @@ def initialize(value, tag, tag_class)
8585
def to_der
8686
if @value.is_a?(Array)
8787
cons_to_der
88-
elsif @indefinite_length
89-
raise ASN1Error, "indefinite length form cannot be used " \
90-
"with primitive encoding"
9188
else
92-
to_der_internal(der_value)
89+
prim_to_der
9390
end
9491
end
9592

@@ -127,6 +124,10 @@ def cons_to_der
127124
end
128125

129126
def prim_to_der
127+
if @indefinite_length
128+
raise ASN1Error, "indefinite length form cannot be used " \
129+
"with primitive encoding"
130+
end
130131
to_der_internal(der_value)
131132
end
132133

0 commit comments

Comments
 (0)