Sha256: ca6ae1f50bcc830d35c095d58cf18bf878d1dfad9b63400b1a10e6561058adbd

Contents?: true

Size: 689 Bytes

Versions: 5

Compression:

Stored size: 689 Bytes

Contents

require 'spec_helper'

describe "the aes cipher" do

  before do
    @cipher = Gibberish::AES.new("password")
  end

  it "should encrypt text and be compatible with OpenSSL CLI" do
    secret_text = "Made with Gibberish"
    encrypted = @cipher.e(secret_text)
    from_openssl = `echo "#{encrypted}" | openssl enc -d -aes-256-cbc -a -k password`
    from_openssl.must_equal(secret_text)
  end

  it "should decrypt base64 encoded data from the OpenSSL CLI" do
    secret_text = "Made with Gibberish"
    from_openssl = `echo #{secret_text} | openssl enc -aes-256-cbc -a -k password`
    decrypted_text = @cipher.d(from_openssl).chomp
    decrypted_text.must_equal(secret_text)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gibberish-1.2.0 spec/aes_spec.rb
gibberish-1.1.0 spec/aes_spec.rb
gibberish-1.0.2 spec/aes_spec.rb
gibberish-1.0.1 spec/aes_spec.rb
gibberish-1.0.0 spec/aes_spec.rb