keylara_chacha20 (keylara v1.0.0)

Summary

Functions

Decrypt data using ChaCha20 with counter = 0

Decrypt data using ChaCha20 with specified counter

Encrypt data using ChaCha20 with counter = 0

Encrypt data using ChaCha20 with specified counter

Generate ChaCha20 key using Alara distributed entropy

Generate ChaCha20 nonce using Alara distributed entropy

Get ChaCha20 key size in bytes

Get ChaCha20 nonce size in bytes

Validate ChaCha20 key format and size

Validate ChaCha20 nonce format and size

Types

chacha20_counter/0

-type chacha20_counter() :: non_neg_integer().

chacha20_key/0

-type chacha20_key() :: binary().

chacha20_nonce/0

-type chacha20_nonce() :: binary().

keylara_error/0

-type keylara_error() :: {error, term()}.

Functions

decrypt(EncryptedData, Key, Nonce)

-spec decrypt(binary(), chacha20_key(), chacha20_nonce()) -> {ok, binary()} | keylara_error().

Decrypt data using ChaCha20 with counter = 0

decrypt(EncryptedData, Key, Nonce, Counter)

-spec decrypt(binary(), chacha20_key(), chacha20_nonce(), chacha20_counter()) ->
                 {ok, binary()} | keylara_error().

Decrypt data using ChaCha20 with specified counter

encrypt(Data, Key, Nonce)

-spec encrypt(binary(), chacha20_key(), chacha20_nonce()) -> {ok, binary()} | keylara_error().

Encrypt data using ChaCha20 with counter = 0

encrypt(Data, Key, Nonce, Counter)

-spec encrypt(binary(), chacha20_key(), chacha20_nonce(), chacha20_counter()) ->
                 {ok, binary()} | keylara_error().

Encrypt data using ChaCha20 with specified counter

generate_key(NetPid)

-spec generate_key(pid()) -> {ok, chacha20_key()} | keylara_error().

Generate ChaCha20 key using Alara distributed entropy

generate_nonce(NetPid)

-spec generate_nonce(pid()) -> {ok, chacha20_nonce()} | keylara_error().

Generate ChaCha20 nonce using Alara distributed entropy

get_key_size()

-spec get_key_size() -> integer().

Get ChaCha20 key size in bytes

get_nonce_size()

-spec get_nonce_size() -> integer().

Get ChaCha20 nonce size in bytes

validate_key(Key)

-spec validate_key(term()) -> ok | keylara_error().

Validate ChaCha20 key format and size

validate_nonce(Nonce)

-spec validate_nonce(term()) -> ok | keylara_error().

Validate ChaCha20 nonce format and size