diff options
author | Vincent Sanders <vince@kyllikki.org> | 2020-02-21 19:52:14 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2020-02-21 19:52:14 +0000 |
commit | b7199a77aca01f85a3359737cd4e6c73c29bd82a (patch) | |
tree | 2b2cc48e145ef725e967886570623dd305402cd7 /include/nsutils | |
parent | 28a80ecdf8588afe5ee521acf3ba48d81aae7373 (diff) | |
download | libnsutils-b7199a77aca01f85a3359737cd4e6c73c29bd82a.tar.gz libnsutils-b7199a77aca01f85a3359737cd4e6c73c29bd82a.tar.bz2 |
extend base64 api with url safe versions
Diffstat (limited to 'include/nsutils')
-rw-r--r-- | include/nsutils/base64.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/include/nsutils/base64.h b/include/nsutils/base64.h index 2baeec6..6dba643 100644 --- a/include/nsutils/base64.h +++ b/include/nsutils/base64.h @@ -36,6 +36,23 @@ nsuerror nsu_base64_encode_alloc(const uint8_t *input, size_t *output_length); /** + * Base 64 encode data. + * + * allocate a buffer and encode source data into it using the base64 URL safe + * encoding. + * + * \param input The source data to encode. + * \param input_length The length of the source data. + * \param output The buffer to recive data into, the caller must free. + * \param output_length The length of data placed in \a output + * \return NSERROR_OK on success and \a output updated else error code. + */ +nsuerror nsu_base64_encode_alloc_url(const uint8_t *input, + size_t input_length, + uint8_t **output, + size_t *output_length); + +/** * Base 64 decode data. * * allocate a buffer and decode source data into it using the Base64 encoding. @@ -50,5 +67,22 @@ nsuerror nsu_base64_decode_alloc(const uint8_t *input, size_t input_length, uint8_t **output, size_t *output_length); - + +/** + * Base 64 decode data. + * + * Allocate a buffer and decode source data into it using the Base64 URL safe + * encoding. + * + * \param input The source data to decode. + * \param input_length The length of the source data. + * \param output The buffer to recive data into, the caller must free. + * \param output_length The length of data placed in \a output + * \return NSERROR_OK on success and \a output updated else error code. + */ +nsuerror nsu_base64_decode_alloc_url(const uint8_t *input, + size_t input_length, + uint8_t **output, + size_t *output_length); + #endif |