Sha256: 389db14b59a7e8aff3621b7c3f889254cc695206f741dbe4dbad84703cabd725

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

module RASN1
  module Types
    # ASN.1 UTF8 String
    # @author Sylvain Daubert
    class Utf8String < OctetString
      # Utf8String id value
      ID = 12

      # Get ASN.1 type
      # @return [String]
      def self.type
        'UTF8String'
      end

      private

      def value_to_der
        @value.to_s.force_encoding('UTF-8').force_encoding('BINARY')
      end

      def der_to_value(der, ber: false)
        super
        @value.force_encoding('UTF-8')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rasn1-0.8.0 lib/rasn1/types/utf8_string.rb