lib/symmetric_encryption/cipher.rb in symmetric-encryption-3.8.2 vs lib/symmetric_encryption/cipher.rb in symmetric-encryption-3.8.3
- old
+ new
@@ -381,11 +381,11 @@
len = buffer.slice!(0..1).unpack('v').first
iv = buffer.slice!(0..len-1)
end
if include_key
len = buffer.slice!(0..1).unpack('v').first
- key = decryption_cipher.binary_decrypt(buffer.slice!(0..len-1), header=false)
+ key = decryption_cipher.binary_decrypt(buffer.slice!(0..len-1), false)
end
if include_cipher
len = buffer.slice!(0..1).unpack('v').first
cipher_name = buffer.slice!(0..len-1)
end
@@ -474,10 +474,10 @@
openssl_cipher.iv = iv if iv
# Set the binary indicator on the header if string is Binary Encoded
self.class.build_header(version, compress, random_iv ? iv : nil, nil, nil) +
openssl_cipher.update(compress ? Zlib::Deflate.deflate(string) : string)
else
- openssl_cipher.iv = @iv if @iv
+ openssl_cipher.iv = @iv if defined?(@iv) && @iv
openssl_cipher.update(string)
end
result << openssl_cipher.final
end