Sha256: cad6213950d98b699208421c51f6aa6118f3ce27d9abd8298462fa350ba5315c

Contents?: true

Size: 592 Bytes

Versions: 6

Compression:

Stored size: 592 Bytes

Contents

module RASN1
  module Types

    # ASN.1 Null
    # @author Sylvain Daubert
    class Null < Primitive
      TAG = 0x05

      # @return [String]
      def inspect(level=0)
        str = ''
        str << '  ' * level if level > 0
        str << "#{@name} " unless @name.nil?
        str << "#{type}"
        str << " OPTIONAL" if optional?
        str
      end

      private

      def value_to_der
        ''
      end

      def der_to_value(der, ber: false)
        raise ASN1Error, "NULL TAG should not have content!" if der.length > 0
        @value = nil
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rasn1-0.6.8 lib/rasn1/types/null.rb
rasn1-0.6.7 lib/rasn1/types/null.rb
rasn1-0.6.6 lib/rasn1/types/null.rb
rasn1-0.6.5 lib/rasn1/types/null.rb
rasn1-0.6.4 lib/rasn1/types/null.rb
rasn1-0.6.3 lib/rasn1/types/null.rb