Class: Aws::S3::Encryption::DefaultCipherProvider Private
- Inherits:
-
Object
- Object
- Aws::S3::Encryption::DefaultCipherProvider
- Defined in:
- lib/aws-sdk-resources/services/s3/encryption/default_cipher_provider.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
-
#decryption_cipher(envelope) ⇒ Cipher
private
Given an encryption envelope, returns a decryption cipher.
-
#encryption_cipher ⇒ Array<Hash,Cipher>
private
Creates an returns a new encryption envelope and encryption cipher.
-
#initialize(options = {}) ⇒ DefaultCipherProvider
constructor
private
A new instance of DefaultCipherProvider.
Constructor Details
#initialize(options = {}) ⇒ DefaultCipherProvider
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 DefaultCipherProvider.
9 10 11 |
# File 'lib/aws-sdk-resources/services/s3/encryption/default_cipher_provider.rb', line 9 def initialize( = {}) @key_provider = [:key_provider] end |
Instance Method Details
#decryption_cipher(envelope) ⇒ Cipher
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 Given an encryption envelope, returns a decryption cipher.
27 28 29 30 31 32 |
# File 'lib/aws-sdk-resources/services/s3/encryption/default_cipher_provider.rb', line 27 def decryption_cipher(envelope) master_key = @key_provider.key_for(envelope['x-amz-matdesc']) key = Utils.decrypt(master_key, decode64(envelope['x-amz-key'])) iv = decode64(envelope['x-amz-iv']) Utils.aes_decryption_cipher(:CBC, key, iv) end |
#encryption_cipher ⇒ Array<Hash,Cipher>
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 Creates an returns a new encryption envelope and encryption cipher.
15 16 17 18 19 20 21 22 23 |
# File 'lib/aws-sdk-resources/services/s3/encryption/default_cipher_provider.rb', line 15 def encryption_cipher cipher = Utils.aes_encryption_cipher(:CBC) envelope = { 'x-amz-key' => encode64(encrypt(envelope_key(cipher))), 'x-amz-iv' => encode64(envelope_iv(cipher)), 'x-amz-matdesc' => materials_description, } [envelope, cipher] end |