mbedTLS + 0/3 examples
CodeScope will show references to mbedtls_pk_parse_key() from the following samples and libraries:
Examples
STM32469I_EVAL
Applications
mbedTLS
STM324x9I_EVAL
Applications
mbedTLS
STM324xG_EVAL
Applications
mbedTLS
 
Symbols
loading...
Files
loading...

mbedtls_pk_parse_key() function

Parse a private key in PEM or DER format

Syntax

int mbedtls_pk_parse_key( mbedtls_pk_context *ctx,     const unsigned char *key,     size_t keylen,     const unsigned char *pwd,     size_t pwdlen );
Implemented in pkparse.c:1164

Arguments

ctx

The PK context to fill. It must have been initialized but not set up.

key

Input buffer to parse. The buffer must contain the input exactly, with no extra trailing material. For PEM, the buffer must contain a null-terminated string.

keylen

Size of \b key in bytes. For PEM data, this includes the terminating null byte, so \p keylen must be equal to `strlen(key) + 1`.

pwd

Optional password for decryption. Pass \c NULL if expecting a non-encrypted key. Pass a string of \p pwdlen bytes if expecting an encrypted key; a non-encrypted key will also be accepted. The empty password is not supported.

pwdlen

Size of the password in bytes. Ignored if \p pwd is \c NULL.

Return value

0 if successful, or a specific PK or PEM error code

Notes

On entry, ctx must be empty, either freshly initialised with mbedtls_pk_init() or reset with mbedtls_pk_free(). If you need a specific key type, check the result with mbedtls_pk_can_do(). The key is also checked for correctness.

Examples

mbedtls_pk_parse_key() is referenced by 3 libraries and example projects.

References

LocationText
pkparse.c:1164
int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
pk.h:567
int mbedtls_pk_parse_key( mbedtls_pk_context *ctx,

Call Tree

Data read by mbedtls_pk_parse_key()
Data written by mbedtls_pk_parse_key()
mbedtls_pk_parse_key()
mbedtls_pk_parse_key()::ret
mbedtls_pk_parse_key()::pk_info
all items filtered out
Type of mbedtls_pk_parse_key()
mbedtls_pk_parse_key()
size_t
all items filtered out