qcrypto_privkey_to_mem()

Updated: April 19, 2023

Save a private key to memory

Synopsis:

#include <qcrypto/qcrypto_keys.h>
int qcrypto_privkey_to_mem(qcrypto_ctx_t *ctx,
                           qcrypto_key_t *key,
                           uint8_t *kbuf,
                           size_t *ksize,
                           qcrypto_key_format_t fmt)

Arguments:

ctx
The algorithm context object.
key
The private key handle.
kbuf
The key buffer. To return the actual key size in ksize, specify NULL.
ksize
The size of the provided key buffer. Must be at least as large as the key. The actual key size is returned in ksize if the call is successful.
fmt
The key encoding format (see qcrypto_key_format_t).

Library:

libqcrypto

Description:

This function saves a private key to the specified memory buffer.

Returns:

QCRYPTO_R_EOK if successful or qcrypto_errno if an error occurred.