class RASN1::Types::NumericString

ASN.1 Numeric String @author Sylvain Daubert

Constants

ID

NumericString id value

Public Class Methods

type() click to toggle source

Get ASN.1 type @return [String]

# File lib/rasn1/types/numeric_string.rb, line 13
def self.type
  'NumericString'
end

Private Instance Methods

check_characters() click to toggle source
# File lib/rasn1/types/numeric_string.rb, line 29
def check_characters
  raise ASN1Error, "NUMERIC STRING #{@name}: invalid character: '#{$1}'" if @value.to_s =~ /([^0-9 ])/
end
der_to_value(der, ber: false) click to toggle source
Calls superclass method
# File lib/rasn1/types/numeric_string.rb, line 24
def der_to_value(der, ber: false)
  super
  check_characters
end
value_to_der() click to toggle source
# File lib/rasn1/types/numeric_string.rb, line 19
def value_to_der
  check_characters
  @value.to_s.force_encoding('BINARY')
end