Sha256: 19e3afde73b46a43f195bd167fdb08c54e52ec4e102bc8e6087d58ab59f2de5c

Contents?: true

Size: 758 Bytes

Versions: 10

Compression:

Stored size: 758 Bytes

Contents

# frozen_string_literal: true

module Aws
  module S3
    module Encryption
      # @api private
      class IODecrypter

        # @param [OpenSSL::Cipher] cipher
        # @param [IO#write] io An IO-like object that responds to `#write`.
        def initialize(cipher, io)
          @cipher = cipher.clone
          # Ensure that IO is reset between retries
          @io = io.tap { |io| io.truncate(0) if io.respond_to?(:truncate) }
        end

        # @return [#write]
        attr_reader :io

        def write(chunk)
          # decrypt and write
          @io.write(@cipher.update(chunk))
        end

        def finalize
          @io.write(@cipher.final)
        end

        def size
          @io.size
        end

      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
aws-sdk-s3-1.76.0 lib/aws-sdk-s3/encryption/io_decrypter.rb
aws-sdk-resources-2.11.562 lib/aws-sdk-resources/services/s3/encryption/io_decrypter.rb
aws-sdk-s3-1.75.0 lib/aws-sdk-s3/encryption/io_decrypter.rb
aws-sdk-s3-1.74.0 lib/aws-sdk-s3/encryption/io_decrypter.rb
aws-sdk-s3-1.73.0 lib/aws-sdk-s3/encryption/io_decrypter.rb
aws-sdk-s3-1.72.0 lib/aws-sdk-s3/encryption/io_decrypter.rb
aws-sdk-s3-1.71.1 lib/aws-sdk-s3/encryption/io_decrypter.rb
aws-sdk-s3-1.70.0 lib/aws-sdk-s3/encryption/io_decrypter.rb
aws-sdk-s3-1.69.1 lib/aws-sdk-s3/encryption/io_decrypter.rb
aws-sdk-s3-1.69.0 lib/aws-sdk-s3/encryption/io_decrypter.rb