Sha256: c4e8e920760587933246c541d2af06fd990b3b03cbc37755dfef116db6bec58a

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

module RASN1
  module Types
    # ASN.1 Null
    # @author Sylvain Daubert
    class Null < Primitive
      # Null id value
      ID = 0x05

      # @return [String]
      def inspect(level=0)
        str = common_inspect(level)[0..-2] # remove terminal ':'
        str << ' OPTIONAL' if optional?
        str
      end

      private

      def value_to_der
        ''
      end

      def der_to_value(der, ber: false) # rubocop:disable Lint/UnusedMethodArgument
        raise ASN1Error, 'NULL should not have content!' if der.length.positive?

        @no_value = true
        @value = void_value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rasn1-0.11.0 lib/rasn1/types/null.rb
rasn1-0.10.0 lib/rasn1/types/null.rb
rasn1-0.9.0 lib/rasn1/types/null.rb