Module: Krypt::ASN1::Template::GeneralDefinitions

Included in:
ChoiceDefinitions, ConstructedDefinitions
Defined in:
lib/krypt/asn1/template.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_to_definition(klass, deff) ⇒ Object



115
116
117
118
119
120
121
122
# File 'lib/krypt/asn1/template.rb', line 115

def self.add_to_definition(klass, deff)
  cur_def = klass.instance_variable_get(:@definition)
  cur_def[:layout] << deff
  codec = cur_def[:codec]
  if codec == :SEQUENCE || codec == :SET 
    increase_min_size(cur_def, deff[:options])
  end
end

Instance Method Details

#init_methodsObject



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/krypt/asn1/template.rb', line 86

def init_methods
  declare_prim(:asn1_boolean, Krypt::ASN1::BOOLEAN)
  declare_prim(:asn1_integer, Krypt::ASN1::INTEGER)
  declare_prim(:asn1_bit_string, Krypt::ASN1::BIT_STRING)
  declare_prim(:asn1_octet_string, Krypt::ASN1::OCTET_STRING)
  declare_prim(:asn1_null, Krypt::ASN1::NULL)
  declare_prim(:asn1_object_id, Krypt::ASN1::OBJECT_ID)
  declare_prim(:asn1_enumerated, Krypt::ASN1::ENUMERATED)
  declare_prim(:asn1_utf8_string, Krypt::ASN1::UTF8_STRING)
  declare_prim(:asn1_numeric_string, Krypt::ASN1::NUMERIC_STRING)
  declare_prim(:asn1_printable_string, Krypt::ASN1::PRINTABLE_STRING)
  declare_prim(:asn1_t61_string, Krypt::ASN1::T61_STRING)
  declare_prim(:asn1_videotex_string, Krypt::ASN1::VIDEOTEX_STRING)
  declare_prim(:asn1_ia5_string, Krypt::ASN1::IA5_STRING)
  declare_prim(:asn1_utc_time, Krypt::ASN1::UTC_TIME)
  declare_prim(:asn1_generalized_time, Krypt::ASN1::GENERALIZED_TIME)
  declare_prim(:asn1_graphic_string, Krypt::ASN1::GRAPHIC_STRING)
  declare_prim(:asn1_iso64_string, Krypt::ASN1::ISO64_STRING)
  declare_prim(:asn1_general_string, Krypt::ASN1::GENERAL_STRING)
  declare_prim(:asn1_universal_string, Krypt::ASN1::UNIVERSAL_STRING)
  declare_prim(:asn1_bmp_string, Krypt::ASN1::BMP_STRING)

  declare_special_typed(:asn1_template, :TEMPLATE)
  declare_special_typed(:asn1_sequence_of, :SEQUENCE_OF)
  declare_special_typed(:asn1_set_of, :SET_OF)

  declare_any
end