Class: Aws::S3::Encryption::IOEncrypter Private
- Inherits:
-
Object
- Object
- Aws::S3::Encryption::IOEncrypter
- Defined in:
- lib/aws-sdk-s3/encryption/io_encrypter.rb
Overview
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.
Provides an IO wrapper encrpyting a stream of data. It is possible to use this same object for decrypting. You must initialize it with a decryptiion cipher in that case and the IO object must contain cipher text instead of plain text.
Constant Summary collapse
- ONE_MEGABYTE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1024 * 1024
Instance Attribute Summary collapse
- #size ⇒ Integer readonly private
Instance Method Summary collapse
- #close ⇒ Object private
-
#initialize(cipher, io) ⇒ IOEncrypter
constructor
private
A new instance of IOEncrypter.
- #read(bytes = nil, output_buffer = nil) ⇒ Object private
- #rewind ⇒ Object private
Constructor Details
#initialize(cipher, io) ⇒ IOEncrypter
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 IOEncrypter.
18 19 20 21 22 23 |
# File 'lib/aws-sdk-s3/encryption/io_encrypter.rb', line 18 def initialize(cipher, io) @encrypted = io.size <= ONE_MEGABYTE ? encrypt_to_stringio(cipher, io.read) : encrypt_to_tempfile(cipher, io) @size = @encrypted.size end |
Instance Attribute Details
#size ⇒ Integer (readonly)
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.
26 27 28 |
# File 'lib/aws-sdk-s3/encryption/io_encrypter.rb', line 26 def size @size end |
Instance Method Details
#close ⇒ 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.
41 42 43 |
# File 'lib/aws-sdk-s3/encryption/io_encrypter.rb', line 41 def close @encrypted.close if Tempfile === @encrypted end |
#read(bytes = nil, output_buffer = nil) ⇒ 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.
28 29 30 31 32 33 34 |
# File 'lib/aws-sdk-s3/encryption/io_encrypter.rb', line 28 def read(bytes = nil, output_buffer = nil) if Tempfile === @encrypted && @encrypted.closed? @encrypted.open @encrypted.binmode end @encrypted.read(bytes, output_buffer) end |
#rewind ⇒ 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.
36 37 38 |
# File 'lib/aws-sdk-s3/encryption/io_encrypter.rb', line 36 def rewind @encrypted.rewind end |