Sha256: b876929f79c8ad477a7f8ed8154569b83bc6f92315dc22f6a6c6018247a5365b

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

require_relative 'asn1_object'

module Binenc
  module Ruby
    class ASN1Engine

      def object(type, *args)
        case type
        when :bin, :binary
          ASN1Binary.new(*args)
        when :str, :string
          ASN1String.new(*args)
        when :int, :integer, :number, :num
          ASN1Integer.new(*args)
        when :seq, :sequence
          ASN1Sequence.new(*args)
        when :date, :datetime, :time
          ASN1DateTime.new(*args)
        when :oid
          ASN1OID.new(*args)
        else
          raise BinencEngineException, "Unknown ASN1 object '#{type}'"
        end
      end

      def from_bin(bin)
        ASN1Object.decode(bin)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
binenc-ruby-0.1.0 lib/binenc/asn1_engine/asn1_engine.rb