base64 encoding/decoding
More...
#include <cstdint>
Go to the source code of this file.
|
| namespace | m5 |
| | Top level namespace of M5.
|
| |
|
| uint32_t | m5::utility::encode_base64 (char *out, const uint32_t olen, const uint8_t *buf, const uint32_t blen, const uint8_t line_len, const bool urlEncode, const bool padding) |
| | encode Base64
|
| |
|
uint32_t | m5::utility::encodeBase64 (char *out, const uint32_t olen, const uint8_t *buf, const uint32_t blen) |
| | Encode Base64(PEM)
|
| |
|
uint32_t | m5::utility::encodeBase64URL (char *out, const uint32_t olen, const uint8_t *buf, const uint32_t blen) |
| | Encode Base64URL.
|
| |
| uint32_t | m5::utility::decode_base64 (uint8_t *out, const uint32_t olen, const char *buf, const uint32_t blen, const bool urlEncode, const bool padding) |
| | decode Base64 / Base64URL
|
| |
|
uint32_t | m5::utility::decodeBase64 (uint8_t *out, const uint32_t olen, const char *buf, const uint32_t blen) |
| | Decode Base64(PEM)
|
| |
|
uint32_t | m5::utility::decodeBase64URL (uint8_t *out, const uint32_t olen, const char *buf, const uint32_t blen) |
| | Decode Base64URL.
|
| |
◆ decode_base64()
| uint32_t m5::utility::decode_base64 |
( |
uint8_t * | out, |
|
|
const uint32_t | olen, |
|
|
const char * | buf, |
|
|
const uint32_t | blen, |
|
|
const bool | urlEncode, |
|
|
const bool | padding ) |
decode Base64 / Base64URL
- Parameters
-
| [out] | out | Output buffer (decoded bytes) |
| olen | Output buffer length |
| buf | Input buffer (base64 text; may include CR/LF/spaces) |
| blen | Input buffer length |
| urlEncode | base64url decoding if true |
| padding | Expect/allow padding if true |
- Returns
- Decoded length
- Note
- padding true: Input must contain '='’ padding (RFC 4648 standard)
-
padding false: Input must not contain' ='’. Incomplete groups are auto-completed
◆ encode_base64()
| uint32_t m5::utility::encode_base64 |
( |
char * | out, |
|
|
const uint32_t | olen, |
|
|
const uint8_t * | buf, |
|
|
const uint32_t | blen, |
|
|
const uint8_t | line_len, |
|
|
const bool | urlEncode, |
|
|
const bool | padding ) |
encode Base64
- Parameters
-
| [out] | out | Output buffer |
| olen | Output buffer length |
| buf | Input buffer |
| blen | Input buffer length |
| line_len | ==0 No line breaks ! =0: Line break at that number of characters |
| urlEncode | base64url encoding if true |
| padding | Enable padding if true |
- Returns
- Encoded length