Sha256: f5455f35f9cf57356b7da2ee8d2d3b26726edf416687a7f98dc9bcf12ebcd0e1

Contents?: true

Size: 708 Bytes

Versions: 4

Compression:

Stored size: 708 Bytes

Contents

module RASN1
  module Types

    # ASN.1 ANY: accpets any types
    # @author Sylvain Daubert
    class Any < Base

      # @return [String] DER-formated string
      def to_der
        case @value
        when Base, Model
          @value.to_der
        else
          @value.to_s
        end
      end

      # Parse a DER string. This method updates object: {#value} will a DER string.
      # @param [String] der DER string
      # @param [Boolean] ber if +true+, accept BER encoding
      # @return [Integer] total number of parsed bytes
      def parse!(der, ber: false)
        total_length,  = get_data(der, ber)
        @value = der[0, total_length]
        total_length
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rasn1-0.4.0 lib/rasn1/types/any.rb
rasn1-0.3.1 lib/rasn1/types/any.rb
rasn1-0.3.0 lib/rasn1/types/any.rb
rasn1-0.2.0 lib/rasn1/types/any.rb