Sha256: efd1793652d27faaaf933ea4c55b1169c4c6bb4ab80e14ffa6a59291e1e7c13e

Contents?: true

Size: 521 Bytes

Versions: 4

Compression:

Stored size: 521 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.dup.force_encoding('UTF-8').b
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rasn1-0.13.1 lib/rasn1/types/utf8_string.rb
rasn1-0.13.0 lib/rasn1/types/utf8_string.rb
rasn1-0.12.1 lib/rasn1/types/utf8_string.rb
rasn1-0.12.0 lib/rasn1/types/utf8_string.rb