Exmbus.Crypto (Exmbus v0.3.0)
View SourceWraps the crypto functions used in the Exmbus library.
Summary
Functions
Wraps the crypto_one_time function from the crypto module, just like crypto_one_time/5, but without the IV.
Wraps the crypto_one_time function from the crypto module, catching errors and returning them as {:error, {:crypto_error, e}} tuples. We do this to prevent a bad key from crashing the parse.
Types
@type cipher_iv() :: atom()
@type cipher_no_iv() :: atom()
@type crypto_error() :: {crypto_error_tag(), crypto_error_c_fileinfo(), crypto_error_description()}
@type crypto_error_c_fileinfo() :: term()
@type crypto_error_description() :: String.t()
@type crypto_error_tag() :: :badarg | :notsup | :error
@type crypto_opts() :: [any()]
Functions
@spec crypto_one_time( cipher :: cipher_no_iv(), key :: iodata(), data :: iodata(), flag_or_options :: crypto_opts() | boolean() ) :: {:ok, binary()} | {:error, crypto_error()}
Wraps the crypto_one_time function from the crypto module, just like crypto_one_time/5, but without the IV.
@spec crypto_one_time( cipher :: cipher_iv(), key :: iodata(), iv :: iodata(), data :: iodata(), flag_or_options :: crypto_opts() | boolean() ) :: {:ok, binary()} | {:error, crypto_error()}
Wraps the crypto_one_time function from the crypto module, catching errors and returning them as {:error, {:crypto_error, e}} tuples. We do this to prevent a bad key from crashing the parse.