View Source jose_chacha20_poly1305 behaviour (JOSE v1.11.9)

Summary

Types

Link to this type

additional_authenticated_data/0

View Source
-type additional_authenticated_data() :: binary().
-type chacha20_key() :: <<_:256>>.
-type chacha20_nonce() :: <<_:96>>.
-type cipher_text() :: binary().
-type message() :: binary().
-type plain_text() :: binary().
-type poly1305_mac() :: <<_:128>>.

Callbacks

-callback authenticate(Message, Key, Nonce) -> MAC
                when
                    Message :: message(),
                    Key :: chacha20_key(),
                    Nonce :: chacha20_nonce(),
                    MAC :: poly1305_mac().
-callback decrypt(CipherText, CipherTag, AAD, IV, Key) -> PlainText | error
           when
               CipherText :: cipher_text(),
               CipherTag :: poly1305_mac(),
               AAD :: additional_authenticated_data(),
               IV :: chacha20_nonce(),
               Key :: chacha20_key(),
               PlainText :: binary().
-callback encrypt(PlainText, AAD, IV, Key) -> {CipherText, CipherTag}
           when
               PlainText :: plain_text(),
               AAD :: additional_authenticated_data(),
               IV :: chacha20_nonce(),
               Key :: chacha20_key(),
               CipherText :: cipher_text(),
               CipherTag :: poly1305_mac().
-callback verify(MAC, Message, Key, Nonce) -> boolean()
          when
              MAC :: poly1305_mac(),
              Message :: message(),
              Key :: chacha20_key(),
              Nonce :: chacha20_nonce().

Functions

Link to this function

authenticate(Message, Key, Nonce)

View Source
Link to this function

block_decrypt(_, Key, IV, _)

View Source
Link to this function

block_encrypt(_, Key, IV, _)

View Source
Link to this function

decrypt(CipherText, CipherTag, AAD, IV, CEK)

View Source
Link to this function

encrypt(PlainText, AAD, IV, CEK)

View Source
Link to this function

verify(MAC, Message, Key, Nonce)

View Source