# File lib/aws/s3/encryption_utils.rb, line 59 def decrypt data, key rsa = OpenSSL::PKey::RSA begin case key when rsa # Asymmetric Decryption key.private_decrypt(data) when String # Symmetric Decryption cipher = get_aes_cipher(:decrypt, :ECB, key) cipher.update(data) + cipher.final end rescue OpenSSL::Cipher::CipherError raise RuntimeError, "decryption failed, incorrect key?" end end