Commit 0ccdd16
Changed files (2)
spec
support
xml
kit
crypto
spec/support/shell_helper.rb
@@ -5,6 +5,7 @@ require 'English'
RSpec.configure do |config|
config.include(Module.new do
def execute_shell(command)
+ puts command
puts `#{command}`
raise "command failed (#{$CHILD_STATUS}): #{command}" unless $CHILD_STATUS.success?
end
spec/xml/kit/crypto/symmetric_cipher_spec.rb
@@ -12,7 +12,8 @@ RSpec.describe ::Xml::Kit::Crypto::SymmetricCipher do
let(:openssl_algorithm) { Xml::Kit::Crypto::SymmetricCipher::ALGORITHMS[xml_algorithm].downcase }
let(:bytes_length) { bit_length / 8 }
let(:key) { SecureRandom.random_bytes(bytes_length) }
- let(:iv) { SecureRandom.random_bytes(bytes_length) }
+ let(:iv) { SecureRandom.random_bytes(cipher.iv_len) }
+ let(:cipher) { OpenSSL::Cipher.new(openssl_algorithm) }
describe 'encrypting and decrypting' do
subject { described_class.new(xml_algorithm, key) }