Sha256: e0e04713b47d42c9f61c81f67aacccd2bed92a97762380b7253466c8d12f0eb8

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

module RASN1
  module Types

    # ASN.1 Octet String
    #
    # An OCTET STRINT may contain another primtive object:
    #  os = OctetString.new(:os)
    #  int = Integer.new(:int)
    #  int.value = 12
    #  os.value = int
    #  os.to_der   # => DER string with INTEGER in OCTET STRING
    # @author Sylvain Daubert
    class OctetString < Primitive
      TAG = 0x04

      private

      def value_to_der
        case @value
        when Base
          @value.to_der
        else
          @value.to_s
        end
      end

      def der_to_value(der, ber:false)
        @value = der
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rasn1-0.3.1 lib/rasn1/types/octet_string.rb
rasn1-0.3.0 lib/rasn1/types/octet_string.rb
rasn1-0.2.0 lib/rasn1/types/octet_string.rb
rasn1-0.1.0 lib/rasn1/types/octet_string.rb