Back to the files list
PBKDF2 (Password-Based Key Derivation Function)
More...
|
#define | cx_pbkdf2_sha512(password, password_len, salt, salt_len, iterations, out, out_len) cx_pbkdf2_no_throw(CX_SHA512, password, password_len, salt, salt_len, iterations, out, out_len) |
| Computes a PBKDF2 bytes sequence with SHA512. More...
|
|
cx_err_t | cx_pbkdf2_no_throw (cx_md_t md_type, const uint8_t *password, size_t passwordlen, uint8_t *salt, size_t saltlen, uint32_t iterations, uint8_t *out, size_t outLength) |
| Computes a PBKDF2 bytes sequence. More...
|
static void | cx_pbkdf2 (cx_md_t md_type, const unsigned char *password, unsigned short passwordlen, unsigned char *salt, unsigned short saltlen, unsigned int iterations, unsigned char *out, unsigned int outLength) |
| Computes a PBKDF2 bytes sequence. More...
|
Detailed Description
PBKDF2 (Password-Based Key Derivation Function)
PBKDF2 is a key derivation function i.e. it produces a key from a base key (a password) and other parameters (a salt and an iteration counter). It consists in iteratively deriving HMAC.
cx_pbkdf2_sha512
#define cx_pbkdf2_sha512 |
( |
password, |
|
password_len, |
|
salt, |
|
salt_len, |
|
iterations, |
|
out, |
|
out_len |
) |
cx_pbkdf2_no_throw(CX_SHA512, password, password_len, salt, salt_len, iterations, out, out_len) |
Computes a PBKDF2 bytes sequence with SHA512.
It computes the bytes sequence according to RFC 2898 with SHA512 as the underlying hash function.
- Parameters
-
[in] | password | Password used as a base key to compute the HMAC. |
[in] | password_len | Length of the password i.e. the length of the HMAC key. |
[in] | salt | Initial salt. |
[in] | salt_len | Length of the salt. |
[in] | iterations | Per block iteration. |
[out] | out | Buffer where to store the output. |
[in] | out_len | Lengh of the output. |
- Returns
- Error code:
- CX_OK
- CX_INVALID_PARAMETER
cx_pbkdf2()
static void cx_pbkdf2 |
( |
cx_md_t |
md_type, |
|
const unsigned char * |
password, |
|
unsigned short |
passwordlen, |
|
unsigned char * |
salt, |
|
unsigned short |
saltlen, |
|
unsigned int |
iterations, |
|
unsigned char * |
out, |
|
unsigned int |
outLength |
) |
|
Computes a PBKDF2 bytes sequence.
It computes the bytes sequence according to RFC 2898 . This function throws an exception if the computation doesn't succeed.
- Warning
- It is recommended to use cx_pbkdf2_no_throw rather than this function.
- Parameters
-
[in] | md_type | Message digest algorithm identifier. |
[in] | password | Password used as a base key to compute the HMAC. |
[in] | passwordlen | Length of the password i.e. the length of the HMAC key. |
[in] | salt | Initial salt. |
[in] | saltlen | Length of the salt. |
[in] | iterations | Per block iteration. |
[out] | out | Buffer where to store the output. |
[in] | outLength | Lengh of the output. |
- Exceptions
-
cx_pbkdf2_no_throw()
cx_err_t cx_pbkdf2_no_throw |
( |
cx_md_t |
md_type, |
|
const uint8_t * |
password, |
|
size_t |
passwordlen, |
|
uint8_t * |
salt, |
|
size_t |
saltlen, |
|
uint32_t |
iterations, |
|
uint8_t * |
out, |
|
size_t |
outLength |
) |
Computes a PBKDF2 bytes sequence.
It computes the bytes sequence according to RFC 2898 .
- Parameters
-
[in] | md_type | Message digest algorithm identifier. |
[in] | password | Password used as a base key to compute the HMAC. |
[in] | passwordlen | Length of the password i.e. the length of the HMAC key. |
[in] | salt | Initial salt. |
[in] | saltlen | Length of the salt. |
[in] | iterations | Per block iteration. |
[out] | out | Buffer where to store the output. |
[in] | outLength | Lengh of the output. |
- Returns
- Error code:
- CX_OK
- CX_INVALID_PARAMETER
Back to the files list