45 lines
797 B
C
45 lines
797 B
C
/**
|
|
* Cryptographic functions
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
/**
|
|
* Generate device private key, if required
|
|
*
|
|
* @returns true if a key was generated, false otherwise
|
|
*/
|
|
bool crypto_gen_priv_key();
|
|
|
|
/**
|
|
* Print current device private key
|
|
*/
|
|
void crypto_print_priv_key();
|
|
|
|
/**
|
|
* Get CSR
|
|
*
|
|
* @return NULL in case of failure or a buffer that must be
|
|
* freed in case of success
|
|
*/
|
|
char *crypto_get_csr();
|
|
|
|
/**
|
|
* Encode buffer to base64 safe URL string
|
|
*
|
|
* @return A buffer that needs to be freed or NULL in case of failure
|
|
*/
|
|
char *crypto_encode_base64_safe_url(const char *src, size_t srclen);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|