Sha256: 988e855febd0025725c1a76356a0d4c4ca20e8935e7d60b6d16c7b65aecfa767

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module RASN1
  module Types
    # ASN.1 Null
    # @author Sylvain Daubert
    class Null < Primitive
      # Null tag value
      TAG = 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)
        raise ASN1Error, 'NULL TAG should not have content!' if der.length.positive?

        @value = nil
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rasn1-0.7.1 lib/rasn1/types/null.rb
rasn1-0.7.0 lib/rasn1/types/null.rb