Botan 3.6.1
Crypto and TLS for C&
|
#include <botan/ffi.h>
#include <botan/kdf.h>
#include <botan/pwdhash.h>
#include <botan/internal/ffi_rng.h>
#include <botan/internal/ffi_util.h>
Go to the source code of this file.
Functions | |
int | botan_bcrypt_generate (uint8_t *out, size_t *out_len, const char *pass, botan_rng_t rng_obj, size_t wf, uint32_t flags) |
int | botan_bcrypt_is_valid (const char *pass, const char *hash) |
int | botan_kdf (const char *kdf_algo, uint8_t out[], size_t out_len, const uint8_t secret[], size_t secret_len, const uint8_t salt[], size_t salt_len, const uint8_t label[], size_t label_len) |
int | botan_pbkdf (const char *algo, uint8_t out[], size_t out_len, const char *pass, const uint8_t salt[], size_t salt_len, size_t iterations) |
int | botan_pbkdf_timed (const char *algo, uint8_t out[], size_t out_len, const char *password, const uint8_t salt[], size_t salt_len, size_t ms_to_run, size_t *iterations_used) |
int | botan_pwdhash (const char *algo, size_t param1, size_t param2, size_t param3, uint8_t out[], size_t out_len, const char *password, size_t password_len, const uint8_t salt[], size_t salt_len) |
int | botan_pwdhash_timed (const char *algo, uint32_t msec, size_t *param1, size_t *param2, size_t *param3, uint8_t out[], size_t out_len, const char *password, size_t password_len, const uint8_t salt[], size_t salt_len) |
int | botan_scrypt (uint8_t out[], size_t out_len, const char *password, const uint8_t salt[], size_t salt_len, size_t N, size_t r, size_t p) |
int botan_bcrypt_generate | ( | uint8_t * | out, |
size_t * | out_len, | ||
const char * | password, | ||
botan_rng_t | rng, | ||
size_t | work_factor, | ||
uint32_t | flags ) |
Create a password hash using Bcrypt
out | buffer holding the password hash, should be of length 64 bytes |
out_len | the desired output length in bytes |
password | the password |
rng | a random number generator |
work_factor | how much work to do to slow down guessing attacks |
flags | should be 0 in current API revision, all other uses are reserved and return BOTAN_FFI_ERROR_BAD_FLAG |
Output is formatted bcrypt $2a$...
Definition at line 157 of file ffi_kdf.cpp.
References BOTAN_FFI_ERROR_BAD_FLAG, BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan::generate_bcrypt(), Botan_FFI::safe_get(), and Botan_FFI::write_str_output().
int botan_bcrypt_is_valid | ( | const char * | pass, |
const char * | hash ) |
Check a previously created password hash
pass | the password to check against |
hash | the stored hash to check against |
Definition at line 188 of file ffi_kdf.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_INVALID_VERIFIER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, Botan::check_bcrypt(), and Botan_FFI::ffi_guard_thunk().
int botan_kdf | ( | const char * | kdf_algo, |
uint8_t | out[], | ||
size_t | out_len, | ||
const uint8_t | secret[], | ||
size_t | secret_len, | ||
const uint8_t | salt[], | ||
size_t | salt_len, | ||
const uint8_t | label[], | ||
size_t | label_len ) |
Derive a key
kdf_algo | KDF algorithm, e.g., "SP800-56C" |
out | buffer holding the derived key, must be of length out_len |
out_len | the desired output length in bytes |
secret | the secret input |
secret_len | size of secret in bytes |
salt | a diversifier |
salt_len | size of salt in bytes |
label | purpose for the derived keying material |
label_len | size of label in bytes |
Definition at line 130 of file ffi_kdf.cpp.
References BOTAN_FFI_SUCCESS, Botan::KDF::create_or_throw(), and Botan_FFI::ffi_guard_thunk().
int botan_pbkdf | ( | const char * | algo, |
uint8_t | out[], | ||
size_t | out_len, | ||
const char * | pass, | ||
const uint8_t | salt[], | ||
size_t | salt_len, | ||
size_t | iterations ) |
Definition at line 22 of file ffi_kdf.cpp.
References botan_pwdhash().
int botan_pbkdf_timed | ( | const char * | pbkdf_algo, |
uint8_t | out[], | ||
size_t | out_len, | ||
const char * | passphrase, | ||
const uint8_t | salt[], | ||
size_t | salt_len, | ||
size_t | milliseconds_to_run, | ||
size_t * | out_iterations_used ) |
Derive a key from a passphrase, running until msec time has elapsed.
pbkdf_algo | PBKDF algorithm, e.g., "PBKDF2(SHA-256)" |
out | buffer to store the derived key, must be of out_len bytes |
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
milliseconds_to_run | if iterations is zero, then instead the PBKDF is run until milliseconds_to_run milliseconds has passed |
out_iterations_used | set to the number iterations executed |
Deprecated: use
botan_pwdhash_timed(pbkdf_algo, static_cast<uint32_t>(ms_to_run), iterations_used, nullptr, nullptr, out, out_len, password, 0, salt, salt_len);
Definition at line 32 of file ffi_kdf.cpp.
References botan_pwdhash_timed().
int botan_pwdhash | ( | const char * | algo, |
size_t | param1, | ||
size_t | param2, | ||
size_t | param3, | ||
uint8_t | out[], | ||
size_t | out_len, | ||
const char * | password, | ||
size_t | password_len, | ||
const uint8_t | salt[], | ||
size_t | salt_len ) |
Definition at line 53 of file ffi_kdf.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, Botan::PasswordHashFamily::create(), and Botan_FFI::ffi_guard_thunk().
Referenced by botan_pbkdf(), and botan_scrypt().
int botan_pwdhash_timed | ( | const char * | algo, |
uint32_t | msec, | ||
size_t * | param1, | ||
size_t * | param2, | ||
size_t * | param3, | ||
uint8_t | out[], | ||
size_t | out_len, | ||
const char * | password, | ||
size_t | password_len, | ||
const uint8_t | salt[], | ||
size_t | salt_len ) |
Definition at line 86 of file ffi_kdf.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, Botan::PasswordHashFamily::create(), and Botan_FFI::ffi_guard_thunk().
Referenced by botan_pbkdf_timed().
int botan_scrypt | ( | uint8_t | out[], |
size_t | out_len, | ||
const char * | passphrase, | ||
const uint8_t | salt[], | ||
size_t | salt_len, | ||
size_t | N, | ||
size_t | r, | ||
size_t | p ) |
Derive a key using scrypt Deprecated; use botan_pwdhash("Scrypt", N, r, p, out, out_len, password, 0, salt, salt_len);
Definition at line 146 of file ffi_kdf.cpp.
References botan_pwdhash().