Erlang Crypto new API does not work with crypto_ops()
Erts: 10.6.4
http://erlang.org/doc/apps/crypto/new_api.html#example-of-crypto_one_time-5
Example:
Key = <<1:128>>.
IV = <<0:128>>.
crypto:crypto_one_time(aes_128_ctr, Key, IV, <<"test">>,true).
Works as expected:
<<113,32,217,161>>
According to documentation:
FlagOrOptions = crypto_opts() | boolean()
crypto_opts() = boolean() | [crypto_opt()]
crypto_opt() = {encrypt, boolean()} | {padding, padding()}
"Selects encryption ({encrypt,true}) or decryption ({encrypt,false}) in the New API."
When I do:
Key = <<1:128>>.
IV = <<0:128>>.
crypto:crypto_one_time(aes_128_ctr, Key, IV, <<"test">>,[{encrypt,true}]).
I got error message:
* exception error: {badarg,{"api_ng.c",72},"Bad enc flag"}
in function crypto:ng_crypto_one_time_nif/5
called as crypto:ng_crypto_one_time_nif(aes_128_ctr,
<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1>>,
<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>,
<<"test">>,
[{encrypt,true}])