aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1kit/types/character_string_types.rb
blob: 93a56828a03f90b5c130058a10ba0125ebf0bb2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# coding: ASCII-8BIT

module ASN1Kit
  class CharacterStringType < Type
    attr_reader :value

    def initialize(string)
      @value = string
    end

    def to_der
      der_header(@value.bytesize) << @value
    end
  end

  class UTF8String < CharacterStringType
    asn1_tag :IMPLICIT, :UNIVERSAL, 12
  end

  class NumericString < CharacterStringType
    asn1_tag :IMPLICIT, :UNIVERSAL, 18
  end

  class PrintableString < CharacterStringType
    TAG_NUMBER = 19
  end

  class TeletexString < CharacterStringType
    TAG_NUMBER = 20
  end
  T61String = TeletexString

  class VideotexString < CharacterStringType
    TAG_NUMBER = 21
  end

  class IA5String < CharacterStringType
    TAG_NUMBER = 22
  end

  class GraphicString < CharacterStringType
    TAG_NUMBER = 25
  end

  class VisibleString < CharacterStringType
    TAG_NUMBER = 26
  end
  ISO646String = VisibleString

  class GeneralString < CharacterStringType
    TAG_NUMBER = 27
  end

  class UniversalString < CharacterStringType
    TAG_NUMBER = 28
  end

  class BMPString < CharacterStringType
    TAG_NUMBER = 30
  end
end