Sha256: d62752106f3581f91adb22a4ad2afc81d5c599ed60d86907dfb2238ade1c8a20

Contents?: true

Size: 1.02 KB

Versions: 20

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe Xmlenc::Algorithms::DES3CBC do
  let(:key) { %w(3219e991eccd9186bf75a83ef8982fd0df4558fd1a837aa2).pack('H*') }
  let(:iv) { %w(918eac719c69c915).pack('H*') }
  let(:cipher_value) { Base64.decode64 "kY6scZxpyRXQbaDZp+LbuvSFYgmI3pQrfsrCVt3/9sZzpeUTPXJEatQ5KPOX\nYpJCGid01h/T8PIezic0Ooz/jU+r3kYMKesMYiXin4CXTZYcGhd0TjmOd4kg\n1vlhE8ktWLC7JDzFLPAqXbOug3ghmWunFiUETbGJaF5V4AHIoZrYP+RS3DTL\ngJcATuDeWyOdueqnLefXiCDNqgSTsK4OyNlX0fpUJgKbL+Mhf5vsqxyIqDsS\n/p6cRA==\n" }
  let(:data) { "<CreditCard Currency=\"USD\" Limit=\"5,000\">\r\n    <Number>4019 2445 0277 5567</Number>\r\n    <Issuer>Bank of the Internet</Issuer>\r\n    <Expiration Time=\"04/02\"/>\r\n  </CreditCard>" }
  subject { described_class.setup(key) }

  describe 'encrypt' do
    it 'encrypts the data' do
      subject.stub(:iv).and_return(iv)
      expect(subject.encrypt(data)).to be == cipher_value
    end
  end

  describe 'decrypt' do
    it 'decrypts the cipher_value' do
      expect(subject.decrypt(cipher_value)).to be == data
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
xmlenc-0.6.5 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.6.4 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.6.3 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.6.2 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.6.1 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.6.0 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.5.0 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.4.1 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.4.0 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.3.0 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.2.1 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.2.0 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.1.7 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.1.6 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.1.5 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.1.4 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.1.3 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.1.2 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.1.1 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.1.0 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb