View Source jose_xchacha20_poly1305 behaviour (JOSE v1.11.10)

Summary

Types

Link to this type

additional_authenticated_data/0

View Source
-type additional_authenticated_data() :: binary().
-type cipher_text() :: binary().
-type message() :: binary().
-type plain_text() :: binary().
-type poly1305_mac() :: <<_:128>>.
-type xchacha20_key() :: <<_:256>>.
-type xchacha20_nonce() :: <<_:192>>.

Callbacks

-callback authenticate(Message, Key, Nonce) -> MAC
                when
                    Message :: message(),
                    Key :: xchacha20_key(),
                    Nonce :: xchacha20_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 :: xchacha20_nonce(),
               Key :: xchacha20_key(),
               PlainText :: binary().
-callback encrypt(PlainText, AAD, IV, Key) -> {CipherText, CipherTag}
           when
               PlainText :: plain_text(),
               AAD :: additional_authenticated_data(),
               IV :: xchacha20_nonce(),
               Key :: xchacha20_key(),
               CipherText :: cipher_text(),
               CipherTag :: poly1305_mac().
-callback verify(MAC, Message, Key, Nonce) -> boolean()
          when
              MAC :: poly1305_mac(),
              Message :: message(),
              Key :: xchacha20_key(),
              Nonce :: xchacha20_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