fs_crypto_key_gen()

Updated: May 06, 2022

Generate an encryption key from a password

Synopsis:

#include <fs_crypto_api.h>
#include <sys/fs_crypto.h>

int fs_crypto_key_gen( const char *password,
                       int plen,
                       const uint8_t *salt,
                       int slen,
                       uint8_t *key,
                       int klen );

Arguments:

password
The password to encrypt.
plen
The number of bytes in the given password string.
salt
The bytes to use as the salt when creating the key.
slen
The number of bytes in the given salt.
key
An array where the function can store the generated key. This must be FS_CRYPTO_MAX_KEY_SIZE bytes long.
klen
The number of bytes in the key array.

Library:

libfscrypto

Use the -l fscrypto option to qcc to link against this library.

Description:

The fs_crypto_key_gen() function generates an encryption key from a secret password and public salt data. It uses a private implementation of the PKCS #5 PBKDF2 algorithm; you can use a different implementation if your system needs greater security.

Note: In order to use filesystem encryption, download the Encrypted Filesystem package from the QNX Software Center.

Returns:

EOK
Success.
EINVAL
Invalid arguments, or an error occurred in generating the key.

Classification:

QNX Neutrino

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes