Sha256: 66c4f148a9a263d91bc50fcb41997a1c9eea9c18376f1270ce1f1cd6c8f8c669
Contents?: true
Size: 1.23 KB
Versions: 7
Compression:
Stored size: 1.23 KB
Contents
require 'spec_helper' require 'openssl' describe Encryption::Symmetric do it 'should be configurable with a block' do key = String.random iv = String.random cipher = String.random encryptor = Encryption::Symmetric.new encryptor.config do |config| config.key = key config.iv = iv config.cipher = cipher end encryptor.key.should == key encryptor.iv.should == iv encryptor.cipher.should == cipher end %x(openssl list-cipher-commands).split.each do |cipher| next if ['base64', 'zlib'].include? cipher describe 'with cipher ' + cipher do before(:each) do @encryptor = Encryption::Symmetric.new @encryptor.cipher = cipher @string = String.random @encryptor.key = String.random @encryptor.iv = String.random end it 'should generate encryption different then the original string' do encrypted = @encryptor.encrypt(@string) encrypted.should_not == @string end it 'should decrypt, encrypted values and match the original string' do encrypted = @encryptor.encrypt(@string) decrypted = @encryptor.decrypt(encrypted) decrypted.should == @string end end end end
Version data entries
7 entries across 7 versions & 1 rubygems