Sha256: df3e3367677c041db9f3827b45315a0a933f449a8c4e26ae57f870cef824c050

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 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
      allow(subject).to receive(: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

6 entries across 6 versions & 1 rubygems

Version Path
xmlenc-0.8.0 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.7.1 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.7.0 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.6.9 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.6.8 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb
xmlenc-0.6.6 spec/lib/xmlenc/algorithms/des3_cbc_spec.rb