app/models/unidom/common/concerns/aes256_cryptor.rb in unidom-common-2.1.2 vs app/models/unidom/common/concerns/aes256_cryptor.rb in unidom-common-3.0

- old
+ new

@@ -77,10 +77,13 @@ raise ArgumentError.new('The key argument is required.') if key.blank? cipher = OpenSSL::Cipher::AES.new(256, 'CBC') cipher.decrypt cipher.padding = aes_256_padding - cipher.key = key + #cipher.key = key + + times = key.length/cipher.key_len>=1 ? 1 : cipher.key_len/key.length+1 + cipher.key = (key*times)[0..cipher.key_len-1] cipher.update(encoded)+cipher.final end