Class: Aws::S3::EncryptionV3::IOAuthDecrypter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-s3/encryptionV3/io_auth_decrypter.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ IOAuthDecrypter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of IOAuthDecrypter.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :io (required, IO#write)

    An IO-like object that responds to #write.

  • :encrypted_content_length (required, Integer)

    The number of bytes to decrypt from the ‘:io` object. This should be the total size of `:io` minus the length of the cipher auth tag.

  • :cipher (required, OpenSSL::Cipher)

    An initialized cipher that can be used to decrypt the bytes as they are written to the ‘:io` object.



17
18
19
20
21
22
23
# File 'lib/aws-sdk-s3/encryptionV3/io_auth_decrypter.rb', line 17

def initialize(options = {})
  @decrypter = IODecrypter.new(options[:cipher], options[:io])
  @max_bytes = options[:encrypted_content_length]
  @bytes_written = 0
  @cipher = options[:cipher]
  @auth_tag = String.new
end

Instance Method Details

#finalizeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
# File 'lib/aws-sdk-s3/encryptionV3/io_auth_decrypter.rb', line 33

def finalize
  @cipher.auth_tag = @auth_tag
  @decrypter.finalize
end

#ioObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
# File 'lib/aws-sdk-s3/encryptionV3/io_auth_decrypter.rb', line 38

def io
  @decrypter.io
end

#write(chunk) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
30
31
# File 'lib/aws-sdk-s3/encryptionV3/io_auth_decrypter.rb', line 25

def write(chunk)
  chunk = truncate_chunk(chunk)
  return unless chunk.bytesize.positive?

  @bytes_written += chunk.bytesize
  @decrypter.write(chunk)
end