Sha256: bf13506dca018cc1f7451c1a8a01f6964451c39bae07a56a9fc3f52262224915

Contents?: true

Size: 478 Bytes

Versions: 13

Compression:

Stored size: 478 Bytes

Contents

module RASN1
  module Types

    # ASN.1 UTF8 String
    # @author Sylvain Daubert
    class Utf8String < OctetString
      TAG = 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

13 entries across 13 versions & 1 rubygems

Version Path
rasn1-0.6.8 lib/rasn1/types/utf8_string.rb
rasn1-0.6.7 lib/rasn1/types/utf8_string.rb
rasn1-0.6.6 lib/rasn1/types/utf8_string.rb
rasn1-0.6.5 lib/rasn1/types/utf8_string.rb
rasn1-0.6.4 lib/rasn1/types/utf8_string.rb
rasn1-0.6.3 lib/rasn1/types/utf8_string.rb
rasn1-0.6.2 lib/rasn1/types/utf8_string.rb
rasn1-0.6.1 lib/rasn1/types/utf8_string.rb
rasn1-0.6.0 lib/rasn1/types/utf8_string.rb
rasn1-0.5.0 lib/rasn1/types/utf8_string.rb
rasn1-0.4.0 lib/rasn1/types/utf8_string.rb
rasn1-0.3.1 lib/rasn1/types/utf8_string.rb
rasn1-0.3.0 lib/rasn1/types/utf8_string.rb