jose_xchacha20_poly1305 behaviour (JOSE v1.11.12)

View Source

Summary

Types

additional_authenticated_data/0

-type additional_authenticated_data() :: binary().

cipher_text/0

-type cipher_text() :: binary().

message/0

-type message() :: binary().

plain_text/0

-type plain_text() :: binary().

poly1305_mac/0

-type poly1305_mac() :: <<_:128>>.

xchacha20_key/0

-type xchacha20_key() :: <<_:256>>.

xchacha20_nonce/0

-type xchacha20_nonce() :: <<_:192>>.

Callbacks

authenticate/3

-callback authenticate(Message, Key, Nonce) -> MAC
                          when
                              Message :: message(),
                              Key :: xchacha20_key(),
                              Nonce :: xchacha20_nonce(),
                              MAC :: poly1305_mac().

decrypt/5

-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().

encrypt/4

-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().

verify/4

-callback verify(MAC, Message, Key, Nonce) -> boolean()
                    when
                        MAC :: poly1305_mac(),
                        Message :: message(),
                        Key :: xchacha20_key(),
                        Nonce :: xchacha20_nonce().

Functions

authenticate(Message, Key, Nonce)

block_decrypt(_, Key, IV, _)

block_encrypt(_, Key, IV, _)

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

encrypt(PlainText, AAD, IV, CEK)

verify(MAC, Message, Key, Nonce)