pbcs v0.1.0 PBCS.ContentEncryptor behaviour View Source

Callback module for content encryptors.

Implement this behaviour if you want to implement your own content encryptor.

Link to this section Summary

Link to this section Types

Link to this type t() View Source
t() :: %PBCS.ContentEncryptor{module: module(), params: any()}

Link to this section Functions

Link to this function decrypt(content_encryptor, key, iv, arg) View Source
Link to this function encrypt(content_encryptor, key, iv, arg) View Source
Link to this function generate_iv(content_encryptor) View Source
Link to this function generate_key(content_encryptor) View Source
Link to this function key_length(content_encryptor) View Source

Link to this section Callbacks

Link to this callback decrypt(params, key, iv, {}) View Source
decrypt(
  params :: any(),
  key :: binary(),
  iv :: binary(),
  {aad :: binary(), cipher_text :: binary(), cipher_tag :: binary()}
) :: {:ok, binary()} | :error
Link to this callback encrypt(params, key, iv, {}) View Source
encrypt(
  params :: any(),
  key :: binary(),
  iv :: binary(),
  {aad :: binary(), plain_text :: binary()}
) :: {binary(), binary()}
Link to this callback generate_iv(params) View Source
generate_iv(params :: any()) :: binary()
Link to this callback generate_key(params) View Source
generate_key(params :: any()) :: binary()
Link to this callback init(protected, opts) View Source
init(protected :: map(), opts :: Keyword.t()) ::
  {:ok, any()} | {:error, String.t()}
Link to this callback key_length(params) View Source
key_length(params :: any()) :: non_neg_integer()