abcrypt_encrypt(3)

NAME

abcrypt_encrypt - API function

SYNOPSIS

#include <abcrypt.h>

enum abcrypt_error_code abcrypt_encrypt(uint8_t *plaintext,
                                        uintptr_t plaintext_len,
                                        uint8_t *passphrase,
                                        uintptr_t passphrase_len,
                                        uint8_t *out,
                                        uintptr_t out_len);

DESCRIPTION

This function encrypts plaintext and write to out.

This uses the recommended Argon2 parameters according to the OWASP Password Storage Cheat Sheet. This also uses Argon2id as the Argon2 type and version 0x13 as the Argon2 version.

Arguments

plaintext

A pointer to the plaintext to encrypt.

plaintext_len

Length of plaintext.

passphrase

A pointer to the passphrase used for encryption.

passphrase_len

Length of passphrase.

out

A pointer to where to write the ciphertext.

out_len

Length of out.

Behavior is undefined if any of the following are true:
  • plaintext or plaintext_len is invalid.

  • passphrase or passphrase_len is invalid.

  • out or out_len is invalid.

RETURN VALUE

Returns ABCRYPT_ERROR_CODE_OK if successful, otherwise returns an error value defined in abcrypt_error_code(3).

VERSIONS

This function was added in version 0.1.0.

Copyright © 2022 Shun Sakai

This manual page is distributed under the terms of the Creative Commons Attribution 4.0 International Public License.

SEE ALSO

abcrypt_decrypt(3), abcrypt_encrypt_with_params(3), abcrypt_encrypt_with_context(3)