rasn1 0.12.1 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -0
- data/lib/rasn1/model.rb +35 -14
- data/lib/rasn1/tracer.rb +5 -5
- data/lib/rasn1/types/any.rb +4 -3
- data/lib/rasn1/types/base.rb +3 -3
- data/lib/rasn1/types/choice.rb +7 -4
- data/lib/rasn1/types/constrained.rb +3 -15
- data/lib/rasn1/types/generalized_time.rb +32 -29
- data/lib/rasn1/types/integer.rb +11 -7
- data/lib/rasn1/types/object_id.rb +9 -6
- data/lib/rasn1/types/sequence_of.rb +1 -5
- data/lib/rasn1/types/universal_string.rb +30 -0
- data/lib/rasn1/types.rb +11 -8
- data/lib/rasn1/version.rb +1 -1
- metadata +14 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7f6fe2fadbdb5b72ec51995e911ac9adc7efbf497708ca581c2870ed3622b31
|
4
|
+
data.tar.gz: 6b68a59752a7ee439a7401b51415070b51ef3241f65864d263c1da9bfcdb2290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d67a67c02d381d92ca93552834cdfc5bce175dc31794020c1d39b3fcea6301a50393f1c964c94d04ef7e14b5593275e5f72873bc89097118ce1abe0c6e4c582a
|
7
|
+
data.tar.gz: 5f2a8486a6ec2709ab3ecae6b664a4a731394ee5ada28f8c5908734aaf20b3e485eb6f4f0d74dc25d238191875732e02299eda3ad5d765dd870b39bf880c3e3a
|
data/LICENSE
CHANGED
data/README.md
CHANGED
data/lib/rasn1/model.rb
CHANGED
@@ -68,7 +68,7 @@ module RASN1
|
|
68
68
|
Elem = Struct.new(:name, :proc_or_class, :content) do
|
69
69
|
# @param [String,Symbol] name
|
70
70
|
# @param [Proc,Class] proc_or_class
|
71
|
-
# @param [
|
71
|
+
# @param [Array,nil] content
|
72
72
|
def initialize(name, proc_or_class, content)
|
73
73
|
if content.is_a?(Array)
|
74
74
|
duplicate_names = find_all_duplicate_names(content.map(&:name) + [name])
|
@@ -278,7 +278,7 @@ module RASN1
|
|
278
278
|
# @return [Elem]
|
279
279
|
# @see Types::SetOf#initialize
|
280
280
|
%w[sequence set].each do |type|
|
281
|
-
define_type_accel_of(type, Types.const_get("#{type.capitalize}Of"))
|
281
|
+
define_type_accel_of(type, Types.const_get(:"#{type.capitalize}Of"))
|
282
282
|
end
|
283
283
|
|
284
284
|
# @!method boolean(name, options)
|
@@ -299,6 +299,12 @@ module RASN1
|
|
299
299
|
# @param [Hash] options
|
300
300
|
# @return [Elem]
|
301
301
|
# @see Types::BitString#initialize
|
302
|
+
# @!method bmp_string(name, options)
|
303
|
+
# @!scope class
|
304
|
+
# @param [Symbol,String] name name of object in model
|
305
|
+
# @param [Hash] options
|
306
|
+
# @return [Elem]
|
307
|
+
# @see Types::BmpString#initialize
|
302
308
|
# @!method octet_string(name, options)
|
303
309
|
# @!scope class
|
304
310
|
# @param [Symbol,String] name name of object in model
|
@@ -317,6 +323,12 @@ module RASN1
|
|
317
323
|
# @param [Hash] options
|
318
324
|
# @return [Elem]
|
319
325
|
# @see Types::Enumerated#initialize
|
326
|
+
# @!method universal_string(name, options)
|
327
|
+
# @!scope class
|
328
|
+
# @param [Symbol,String] name name of object in model
|
329
|
+
# @param [Hash] options
|
330
|
+
# @return [Elem]
|
331
|
+
# @see Types::UniversalString#initialize
|
320
332
|
# @!method utf8_string(name, options)
|
321
333
|
# @!scope class
|
322
334
|
# @param [Symbol,String] name name of object in model
|
@@ -449,6 +461,7 @@ module RASN1
|
|
449
461
|
root.value
|
450
462
|
else
|
451
463
|
elt = by_name(name)
|
464
|
+
return nil if elt.nil?
|
452
465
|
|
453
466
|
unless args.empty?
|
454
467
|
args.each do |arg|
|
@@ -492,14 +505,15 @@ module RASN1
|
|
492
505
|
|
493
506
|
# Give a (nested) element from its name
|
494
507
|
# @param [String, Symbol] name
|
495
|
-
# @return [Model, Types::Base]
|
508
|
+
# @return [Model, Types::Base, nil]
|
496
509
|
def by_name(name)
|
497
510
|
elt = self[name]
|
498
511
|
return elt unless elt.nil?
|
499
512
|
|
500
513
|
@elements.each_key do |subelt_name|
|
501
|
-
|
502
|
-
|
514
|
+
subelt = self[subelt_name]
|
515
|
+
if subelt.is_a?(Model)
|
516
|
+
elt = subelt[name]
|
503
517
|
return elt unless elt.nil?
|
504
518
|
end
|
505
519
|
end
|
@@ -529,7 +543,12 @@ module RASN1
|
|
529
543
|
class_element = self.class.class_eval { @root }
|
530
544
|
@root_name = class_element.name
|
531
545
|
@elements = {}
|
532
|
-
@elements[@root_name] =
|
546
|
+
@elements[@root_name] = case class_element
|
547
|
+
when WrapElem
|
548
|
+
generate_wrapper(class_element)
|
549
|
+
else
|
550
|
+
get_type(class_element.proc_or_class, self.class.options || {})
|
551
|
+
end
|
533
552
|
class_element
|
534
553
|
end
|
535
554
|
|
@@ -565,17 +584,18 @@ module RASN1
|
|
565
584
|
|
566
585
|
def initialize_elements(obj, args)
|
567
586
|
args.each do |name, value|
|
568
|
-
|
587
|
+
subobj = obj[name]
|
588
|
+
next unless subobj
|
569
589
|
|
570
590
|
case value
|
571
591
|
when Hash
|
572
|
-
raise ArgumentError, "element #{name}: may only pass a Hash for Model elements" unless
|
592
|
+
raise ArgumentError, "element #{name}: may only pass a Hash for Model elements" unless subobj.is_a?(Model)
|
573
593
|
|
574
|
-
initialize_elements
|
594
|
+
initialize_elements(subobj, value)
|
575
595
|
when Array
|
576
|
-
initialize_element_from_array(
|
596
|
+
initialize_element_from_array(subobj, value)
|
577
597
|
else
|
578
|
-
|
598
|
+
subobj.value = value
|
579
599
|
end
|
580
600
|
end
|
581
601
|
end
|
@@ -644,12 +664,13 @@ module RASN1
|
|
644
664
|
end
|
645
665
|
|
646
666
|
def wrapper_to_h(wrap)
|
647
|
-
|
667
|
+
el = wrap.element
|
668
|
+
case el
|
648
669
|
when Model
|
649
|
-
hsh =
|
670
|
+
hsh = el.to_h
|
650
671
|
hsh[hsh.keys.first]
|
651
672
|
else
|
652
|
-
private_to_h(
|
673
|
+
private_to_h(el)
|
653
674
|
end
|
654
675
|
end
|
655
676
|
end
|
data/lib/rasn1/tracer.rb
CHANGED
@@ -75,8 +75,8 @@ module RASN1
|
|
75
75
|
# @private
|
76
76
|
# Unpatch {#do_parse} to remove tracing ability
|
77
77
|
def stop_tracing
|
78
|
-
alias_method :do_parse, :do_parse_without_tracing
|
79
|
-
alias_method :do_parse_explicit, :do_parse_explicit_without_tracing
|
78
|
+
alias_method :do_parse, :do_parse_without_tracing
|
79
|
+
alias_method :do_parse_explicit, :do_parse_explicit_without_tracing
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -108,7 +108,7 @@ module RASN1
|
|
108
108
|
# @private
|
109
109
|
# Unpatch {#parse!} to remove tracing ability
|
110
110
|
def stop_tracing
|
111
|
-
alias_method :parse!, :parse_without_tracing
|
111
|
+
alias_method :parse!, :parse_without_tracing
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -133,7 +133,7 @@ module RASN1
|
|
133
133
|
# @private
|
134
134
|
# Unpatch {#der_to_value!} to remove tracing ability
|
135
135
|
def stop_tracing
|
136
|
-
alias_method :der_to_value, :der_to_value_without_tracing
|
136
|
+
alias_method :der_to_value, :der_to_value_without_tracing
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -158,7 +158,7 @@ module RASN1
|
|
158
158
|
# @private
|
159
159
|
# Unpatch {#der_to_value!} to remove tracing ability
|
160
160
|
def stop_tracing
|
161
|
-
alias_method :der_to_value, :der_to_value_without_tracing
|
161
|
+
alias_method :der_to_value, :der_to_value_without_tracing
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
data/lib/rasn1/types/any.rb
CHANGED
@@ -61,7 +61,7 @@ module RASN1
|
|
61
61
|
private
|
62
62
|
|
63
63
|
def common_inspect(level)
|
64
|
-
lvl =
|
64
|
+
lvl = [0, level].max
|
65
65
|
str = ' ' * lvl
|
66
66
|
str << "#{@name} " unless @name.nil?
|
67
67
|
str << asn1_class.to_s.upcase << ' ' unless asn1_class == :universal
|
@@ -82,9 +82,10 @@ module RASN1
|
|
82
82
|
total_length += id_size
|
83
83
|
|
84
84
|
@no_value = false
|
85
|
-
|
85
|
+
real_value = der[0, total_length].to_s
|
86
|
+
@value = real_value
|
86
87
|
|
87
|
-
[total_length,
|
88
|
+
[total_length, real_value]
|
88
89
|
end
|
89
90
|
|
90
91
|
def trace_any
|
data/lib/rasn1/types/base.rb
CHANGED
@@ -374,7 +374,7 @@ module RASN1
|
|
374
374
|
end
|
375
375
|
|
376
376
|
def common_inspect(level)
|
377
|
-
lvl = level
|
377
|
+
lvl = [level, 0].max
|
378
378
|
str = ' ' * lvl
|
379
379
|
str << "#{@name} " unless @name.nil?
|
380
380
|
str << asn1_class_to_s
|
@@ -427,7 +427,7 @@ module RASN1
|
|
427
427
|
when nil
|
428
428
|
@asn1_class = :universal
|
429
429
|
when Symbol
|
430
|
-
raise ClassError unless CLASSES.key?
|
430
|
+
raise ClassError unless CLASSES.key?(asn1_class)
|
431
431
|
|
432
432
|
@asn1_class = asn1_class
|
433
433
|
else
|
@@ -621,7 +621,7 @@ module RASN1
|
|
621
621
|
def find_type(id)
|
622
622
|
Types.constants.map { |c| Types.const_get(c) }
|
623
623
|
.select { |klass| klass < Primitive || klass < Constructed }
|
624
|
-
.find { |klass| klass::ID
|
624
|
+
.find { |klass| id == klass::ID }
|
625
625
|
end
|
626
626
|
|
627
627
|
def bin2hex(str)
|
data/lib/rasn1/types/choice.rb
CHANGED
@@ -75,24 +75,27 @@ module RASN1
|
|
75
75
|
# @return [Integer] total number of parsed bytes
|
76
76
|
# @raise [ASN1Error] error on parsing
|
77
77
|
def parse!(der, ber: false)
|
78
|
-
parsed = false
|
79
78
|
@value.each_with_index do |element, i|
|
80
79
|
@chosen = i
|
81
80
|
nb_bytes = element.parse!(der, ber: ber)
|
82
|
-
parsed = true
|
83
81
|
return nb_bytes
|
84
82
|
rescue ASN1Error
|
85
83
|
@chosen = nil
|
86
84
|
next
|
87
85
|
end
|
88
|
-
|
86
|
+
|
87
|
+
@no_value = true
|
88
|
+
@value = void_value
|
89
|
+
raise ASN1Error, "CHOICE #{@name}: no type matching #{der.inspect}" unless optional?
|
90
|
+
|
91
|
+
0
|
89
92
|
end
|
90
93
|
|
91
94
|
# @param [::Integer] level
|
92
95
|
# @return [String]
|
93
96
|
def inspect(level=0)
|
94
97
|
str = common_inspect(level)
|
95
|
-
str << if defined?
|
98
|
+
str << if defined?(@chosen) && value?
|
96
99
|
"\n#{@value[@chosen].inspect(level + 1)}"
|
97
100
|
else
|
98
101
|
' not chosen!'
|
@@ -9,12 +9,8 @@ module RASN1
|
|
9
9
|
module Constrained
|
10
10
|
# Define class/module methods for {Constrained} module
|
11
11
|
module ClassMethods
|
12
|
-
#
|
13
|
-
|
14
|
-
# @return [Proc,nil]
|
15
|
-
def constraint=(constraint)
|
16
|
-
@constraint = constraint
|
17
|
-
end
|
12
|
+
# @return [Proc] proc to check constraints
|
13
|
+
attr_accessor :constraint
|
18
14
|
|
19
15
|
# Check if a constraint is really defined
|
20
16
|
# @return [Boolean]
|
@@ -31,15 +27,7 @@ module RASN1
|
|
31
27
|
end
|
32
28
|
end
|
33
29
|
|
34
|
-
|
35
|
-
# @return [Proc] proc to check constraints
|
36
|
-
attr_reader :constraint
|
37
|
-
|
38
|
-
# Extend +base+ with {ClassMethods}
|
39
|
-
def included(base)
|
40
|
-
base.extend ClassMethods
|
41
|
-
end
|
42
|
-
end
|
30
|
+
extend ClassMethods
|
43
31
|
|
44
32
|
# Redefined +#value=+ to check constraint before assigning +val+
|
45
33
|
# @see Types::Base#value=
|
@@ -71,19 +71,32 @@ module RASN1
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def value_when_fraction_empty(date_hour)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
# Ruby 3.0: special handle for timezone
|
75
|
+
# From 3.1: "Z" and "-0100" are supported
|
76
|
+
# Below 3.1: should be "-01:00" or "+00:00"
|
77
|
+
tz = if date_hour[-1] == 'Z'
|
78
|
+
date_hour.slice!(-1, 1)
|
79
|
+
'+00:00' # Ruby 3.0: to remove after end-of support of ruby 3.0
|
80
|
+
elsif date_hour.match?(/[+-]\d+$/)
|
81
|
+
# Ruby 3.0
|
82
|
+
# date_hour.slice!(-5, 5)
|
83
|
+
zone = date_hour.slice!(-5, 5).to_s
|
84
|
+
"#{zone[0, 3]}:#{zone[3, 2]}"
|
85
|
+
end
|
86
|
+
year = date_hour.slice!(0, 4).to_i
|
87
|
+
month = date_hour.slice!(0, 2).to_i
|
88
|
+
day = date_hour.slice!(0, 2).to_i
|
89
|
+
hour = date_hour.slice!(0, 2).to_i
|
90
|
+
minute = date_hour.slice!(0, 2).to_i
|
91
|
+
second = date_hour.slice!(0, 2).to_i
|
92
|
+
@value = Time.new(year, month, day, hour, minute, second, tz)
|
81
93
|
end
|
82
94
|
|
83
95
|
def value_when_fraction_ends_with_z(date_hour, fraction)
|
84
96
|
fraction = fraction[0...-1]
|
85
97
|
date_hour << 'Z'
|
86
|
-
frac_base =
|
98
|
+
frac_base = compute_frac_base(date_hour)
|
99
|
+
value_when_fraction_empty(date_hour)
|
87
100
|
fix_value(fraction, frac_base)
|
88
101
|
end
|
89
102
|
|
@@ -93,42 +106,32 @@ module RASN1
|
|
93
106
|
# fraction contains fraction and timezone info. Split them
|
94
107
|
fraction = match[1]
|
95
108
|
date_hour << match[2]
|
96
|
-
else
|
97
|
-
# fraction only contains fraction.
|
98
|
-
# Have to add offset with UTC to force Strptime to
|
99
|
-
# generate a local time.
|
100
|
-
date_hour << Time.now.strftime('%z')
|
101
109
|
end
|
102
110
|
|
103
|
-
frac_base =
|
111
|
+
frac_base = compute_frac_base(date_hour)
|
112
|
+
value_when_fraction_empty(date_hour)
|
104
113
|
fix_value(fraction, frac_base)
|
105
114
|
end
|
106
115
|
|
107
|
-
def value_from(date_hour)
|
108
|
-
format, frac_base = strformat(date_hour)
|
109
|
-
@value = Strptime.new(format).exec(date_hour)
|
110
|
-
frac_base
|
111
|
-
end
|
112
|
-
|
113
116
|
def fix_value(fraction, frac_base)
|
114
117
|
frac = ".#{fraction}".to_r * frac_base
|
115
118
|
@value = (@value + frac) unless fraction.nil?
|
116
119
|
end
|
117
120
|
|
118
|
-
def
|
121
|
+
def compute_frac_base(date_hour)
|
119
122
|
case date_hour.size
|
120
|
-
when 11
|
121
|
-
|
122
|
-
when 13, 17
|
123
|
-
|
123
|
+
when 10, 11
|
124
|
+
HOUR_TO_SEC
|
125
|
+
when 12, 13, 17
|
126
|
+
MINUTE_TO_SEC
|
124
127
|
when 15
|
125
128
|
if date_hour[-1] == 'Z'
|
126
|
-
|
129
|
+
SECOND_TO_SEC
|
127
130
|
else
|
128
|
-
|
131
|
+
HOUR_TO_SEC
|
129
132
|
end
|
130
|
-
when 19
|
131
|
-
|
133
|
+
when 14, 19
|
134
|
+
SECOND_TO_SEC
|
132
135
|
else
|
133
136
|
prefix = @name.nil? ? type : "tag #{@name}"
|
134
137
|
raise ASN1Error, "#{prefix}: unrecognized format: #{date_hour}"
|
data/lib/rasn1/types/integer.rb
CHANGED
@@ -45,10 +45,12 @@ module RASN1
|
|
45
45
|
# Integer value
|
46
46
|
# @return [Integer]
|
47
47
|
def to_i
|
48
|
-
|
49
|
-
|
48
|
+
val = value? ? @value : @default
|
49
|
+
case val
|
50
|
+
when String, Symbol
|
51
|
+
@enum[val]
|
50
52
|
else
|
51
|
-
|
53
|
+
val || 0
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
@@ -135,10 +137,12 @@ module RASN1
|
|
135
137
|
end
|
136
138
|
|
137
139
|
def der_to_value(der, ber: false)
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
140
|
+
int_value = der_to_int_value(der, ber: ber)
|
141
|
+
@value = if @enum.empty?
|
142
|
+
int_value
|
143
|
+
else
|
144
|
+
int_to_enum(int_value)
|
145
|
+
end
|
142
146
|
end
|
143
147
|
|
144
148
|
def explicit_type
|
@@ -11,18 +11,21 @@ module RASN1
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def value_to_der
|
14
|
-
ids = @value.to_s.split('.').map
|
14
|
+
ids = @value.to_s.split('.').map(&:to_i)
|
15
15
|
|
16
16
|
raise ASN1Error, "OBJECT ID #{@name}: first subidentifier should be less than 3" if ids[0] > 2
|
17
17
|
raise ASN1Error, "OBJECT ID #{@name}: second subidentifier should be less than 40" if (ids[0] < 2) && (ids[1] > 39)
|
18
18
|
|
19
19
|
ids[0, 2] = ids[0] * 40 + ids[1]
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
octets = []
|
21
|
+
ids.each do |v|
|
22
|
+
if v < 128
|
23
|
+
octets << v
|
24
|
+
else
|
25
|
+
octets.concat(unsigned_to_chained_octets(v))
|
26
|
+
end
|
24
27
|
end
|
25
|
-
|
28
|
+
octets.pack('C*')
|
26
29
|
end
|
27
30
|
|
28
31
|
def der_to_value(der, ber: false) # rubocop:disable Lint/UnusedMethodArgument
|
@@ -144,11 +144,7 @@ module RASN1
|
|
144
144
|
nb_bytes = 0
|
145
145
|
|
146
146
|
while nb_bytes < der.length
|
147
|
-
type =
|
148
|
-
@of_type.dup
|
149
|
-
else
|
150
|
-
of_type_class.new
|
151
|
-
end
|
147
|
+
type = of_type_class.new
|
152
148
|
nb_bytes += type.parse!(der[nb_bytes, der.length])
|
153
149
|
@value << type
|
154
150
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RASN1
|
4
|
+
module Types
|
5
|
+
# ASN.1 UniversalString
|
6
|
+
# @since 0.13.0
|
7
|
+
# @author zeroSteiner
|
8
|
+
class UniversalString < OctetString
|
9
|
+
# UniversalString id value
|
10
|
+
ID = 28
|
11
|
+
|
12
|
+
# Get ASN.1 type
|
13
|
+
# @return [String]
|
14
|
+
def self.type
|
15
|
+
'UniversalString'
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def value_to_der
|
21
|
+
@value.to_s.dup.encode('UTF-32BE').b
|
22
|
+
end
|
23
|
+
|
24
|
+
def der_to_value(der, ber: false)
|
25
|
+
super
|
26
|
+
@value = der.to_s.dup.force_encoding('UTF-32BE')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/rasn1/types.rb
CHANGED
@@ -32,18 +32,20 @@ module RASN1
|
|
32
32
|
# ID and size of identifier octets
|
33
33
|
def self.decode_identifier_octets(der)
|
34
34
|
first_octet = der.unpack1('C').to_i
|
35
|
-
asn1_class = Types::Base::CLASSES.key(first_octet & Types::Base::CLASS_MASK)
|
35
|
+
asn1_class = Types::Base::CLASSES.key(first_octet & Types::Base::CLASS_MASK) || :universal
|
36
36
|
pc = (first_octet & Types::Constructed::ASN1_PC).positive? ? :constructed : :primitive
|
37
37
|
id = first_octet & Types::Base::MULTI_OCTETS_ID
|
38
38
|
|
39
39
|
size = if id == Types::Base::MULTI_OCTETS_ID
|
40
40
|
id = 0
|
41
|
-
|
42
|
-
|
41
|
+
count = 1
|
42
|
+
der[1..-1].to_s.bytes.each do |octet|
|
43
|
+
count += 1
|
43
44
|
|
44
45
|
id = (id << 7) | (octet & 0x7f)
|
45
|
-
break
|
46
|
+
break if (octet & 0x80).zero?
|
46
47
|
end
|
48
|
+
count
|
47
49
|
else
|
48
50
|
1
|
49
51
|
end
|
@@ -98,11 +100,11 @@ module RASN1
|
|
98
100
|
# (value >= 0) && (value < 2**32)
|
99
101
|
# end
|
100
102
|
def self.define_type(name, from:, in_module: self, &block)
|
101
|
-
constraint = block
|
103
|
+
constraint = block&.to_proc
|
102
104
|
|
103
|
-
new_klass = Class.new(from)
|
104
|
-
|
105
|
-
|
105
|
+
new_klass = Class.new(from)
|
106
|
+
new_klass.include(Constrained)
|
107
|
+
new_klass.extend(Constrained::ClassMethods)
|
106
108
|
new_klass.constraint = constraint
|
107
109
|
|
108
110
|
in_module.const_set(name, new_klass)
|
@@ -128,6 +130,7 @@ require_relative 'types/null'
|
|
128
130
|
require_relative 'types/object_id'
|
129
131
|
require_relative 'types/enumerated'
|
130
132
|
require_relative 'types/bmp_string'
|
133
|
+
require_relative 'types/universal_string'
|
131
134
|
require_relative 'types/utf8_string'
|
132
135
|
require_relative 'types/numeric_string'
|
133
136
|
require_relative 'types/printable_string'
|
data/lib/rasn1/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rasn1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- LemonTree55
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: strptime
|
@@ -28,7 +28,7 @@ description: |
|
|
28
28
|
RASN1 is a pure ruby ASN.1 library. It may encode and decode DER and BER
|
29
29
|
encodings.
|
30
30
|
email:
|
31
|
-
-
|
31
|
+
- lenontree@proton.me
|
32
32
|
executables: []
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files:
|
@@ -64,20 +64,21 @@ files:
|
|
64
64
|
- lib/rasn1/types/sequence_of.rb
|
65
65
|
- lib/rasn1/types/set.rb
|
66
66
|
- lib/rasn1/types/set_of.rb
|
67
|
+
- lib/rasn1/types/universal_string.rb
|
67
68
|
- lib/rasn1/types/utc_time.rb
|
68
69
|
- lib/rasn1/types/utf8_string.rb
|
69
70
|
- lib/rasn1/types/visible_string.rb
|
70
71
|
- lib/rasn1/version.rb
|
71
72
|
- lib/rasn1/wrapper.rb
|
72
|
-
homepage: https://github.com/
|
73
|
+
homepage: https://github.com/lemontree55/rasn1
|
73
74
|
licenses:
|
74
75
|
- MIT
|
75
76
|
metadata:
|
76
|
-
homepage_uri: https://github.com/
|
77
|
-
source_code_uri: https://github.com/
|
78
|
-
bug_tracker_uri: https://github.com/
|
77
|
+
homepage_uri: https://github.com/lemontree55/rasn1
|
78
|
+
source_code_uri: https://github.com/lemontree55/rasn1
|
79
|
+
bug_tracker_uri: https://github.com/lemontree55/rasn1/issues
|
79
80
|
documentation_uri: https://www.rubydoc.info/gems/rasn1
|
80
|
-
post_install_message:
|
81
|
+
post_install_message:
|
81
82
|
rdoc_options:
|
82
83
|
- "--title"
|
83
84
|
- RASN1 - A pure ruby ASN.1 library
|
@@ -91,15 +92,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
92
|
requirements:
|
92
93
|
- - ">="
|
93
94
|
- !ruby/object:Gem::Version
|
94
|
-
version: 2.
|
95
|
+
version: 2.7.0
|
95
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
97
|
requirements:
|
97
98
|
- - ">="
|
98
99
|
- !ruby/object:Gem::Version
|
99
100
|
version: '0'
|
100
101
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
-
signing_key:
|
102
|
+
rubygems_version: 3.3.15
|
103
|
+
signing_key:
|
103
104
|
specification_version: 4
|
104
105
|
summary: Ruby ASN.1 library
|
105
106
|
test_files: []
|