ntrepid8 / ex_crypto

Wrapper around the Erlang crypto module for Elixir.
MIT License
144 stars 48 forks source link

using anything but aes_256 as the key fails #22

Open zacksiri opened 6 years ago

zacksiri commented 6 years ago

I'm trying to do basic AES encryption on some text

{:ok, aes_128_key} = ExCrypto.generate_aes_key(:aes_128, :bytes)
{:ok, {_iv, cipher_text}} = ExCrypto.encrypt(aes_128_key, "hi")

and I'm getting this error

** (MatchError) no match of right hand side value: %ErlangError{original: :notsup}
    (ex_crypto) lib/ex_crypto.ex:28: ExCrypto.normalize_error/3

If I use aes_256 everything works.

milica-nerlovic commented 5 years ago

I've encountered the same problem recently. Have you had any luck in figuring out the cause, @zacksiri?

ntrepid8 commented 5 years ago

I think that's an error that bubbled up from the underlying crypto library. What sort of environment are you running in?

milica-nerlovic commented 5 years ago

Yes, 👍 I also found some note about this in the Erlang crypto docs.

Ubuntu 14.04.5 LTS OpenSSL 1.1.1 Erlang/OTP 21 Elixir 1.7.3