danielberkompas / cloak

Elixir encryption library designed for Ecto
MIT License
582 stars 55 forks source link

{:badarg, {'aead.c', 90}, 'Unknown cipher or invalid key size'} #113

Closed MeerKatDev closed 2 years ago

MeerKatDev commented 2 years ago

:crypto.crypto_one_time_aead(:aes_256_gcm, <<65, 158, 136, 212, 153, 218, 25, 165, 113, 112, 252, 35, 62, 67, 240, 173, 10, 120, 96, 91, 41, 233, 225, 176, 7, 56, 141, 181, 225, 224, 200, 201, 104, 178, 249, 195, 105, 22, 8, 146, 118, 61, 221, 80, 74, 20, 132, 230>>, <<57, 185, 151, 234, 105, 35, 196, 228, 6, 87, 207, 176, 92, 32, 115, 165>>, "plaintext", "AES256GCM", 16, true)

This is my config:

config :pro, Pro.Vault,
  ciphers: [
    default: {
      Cloak.Ciphers.AES.GCM,
      tag: "AES.GCM.V1",
      key: Base.decode64!("xxx")
    }
  ]
danielberkompas commented 2 years ago

The key is too short. You need to use a valid 256 bit key.