Open hickscorp opened 6 years ago
Which version of Elixir and Erlang are you using? What operating system?
iex --version
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
IEx 1.6.4 (compiled with OTP 20)
uname -a
Linux Hostname 4.13.0-38-generic #43-Ubuntu SMP Wed Mar 14 15:20:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
I think I see what the issue is. I can probably get it fixed in the next couple days unless you would rather send a pull-request my way with an update.
@ntrepid8 Gladly yes. Tell me what's wrong and I'll fix it if I can.
@hickscorp The function you're calling is
def generate_key(bits, public_exp), do: generate_key(:rsa, bits, public_exp)
therefore you should call it like this
{:ok, key} = ExPublicKey.generate_key(2048, 65537)
or more simply
{:ok, key} = ExPublicKey.generate_key()
which has those default parameters.
@tcitworld Thanks, but what I was pointing out is a documentation inconsistency. See here: https://hexdocs.pm/ex_crypto/0.9.0/ExPublicKey.html#generate_key/0
The docs seem to define a passing doctest reading {:ok, rsa_priv_key} = ExPublicKey.generate_key(:rsa, 2048)
. However when you run it verbatim, it fails.
Straight from the docs:
But this is what I get when running it:
Using 0.9.0.