joker1007 / yaml_vault

Yaml file encryption/decryption helper.
MIT License
158 stars 20 forks source link

Fix "key must be 32 bytes (ArgumentError)" by OpenSSL::Cipher (using ActiveSupport 5) #7

Closed hamakn closed 7 years ago

hamakn commented 7 years ago

Hi, with ActiveSupport 5, spec was broken due to "key must be 32 bytes (ArgumentError)" by OpenSSL::Cipher.

require "yaml_vault"

p ActiveSupport.version # => #<Gem::Version "5.0.1">

yaml =<<YAML
---
development:
  a: 1
YAML

p YamlVault::Main.new(
  yaml, [["development"]], "simple",
  passphrase: "AAAAAAAAAAAAAAAA"
).encrypt_yaml
# => .bundle/ruby/2.4.0/gems/activesupport-5.0.1/lib/active_support/message_encryptor.rb:79:in `key=': key must be 32 bytes (ArgumentError)

WARNING: I don't know downsizing key_size is really safe or not... WARNING-2: This code doesn't care about migrating ActiveSupport 4 to 5...

joker1007 commented 7 years ago

Thanks! I think about compatibility.