class AWS::S3::Crypter
Attributes
cipher[R]
Public Class Methods
new(cipher_name = 'aes-256-cbc')
click to toggle source
# File lib/aws/s3/crypter.rb, line 8 def initialize(cipher_name = 'aes-256-cbc') @cipher = OpenSSL::Cipher::Cipher.new(cipher_name) end
Public Instance Methods
decrypt_data(edata, key, iv)
click to toggle source
# File lib/aws/s3/crypter.rb, line 23 def decrypt_data(edata, key, iv) cipher.decrypt cipher.key = key cipher.iv = iv data = cipher.update(edata) data << cipher.final data.to_s end
encrypt_data(data)
click to toggle source
# File lib/aws/s3/crypter.rb, line 12 def encrypt_data(data) cipher.encrypt key = cipher.random_key iv = cipher.random_iv edata = cipher.update(data) edata << cipher.final [edata, key, iv] end