#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/sbuff.h>
#include <freeradius-devel/util/dbuff.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
Go to the source code of this file.
 | 
| #define  | FR_BASE64_DEC_LENGTH(_inlen)   ((3 * ((_inlen) / 4)) + 2) | 
|   | 
| #define  | fr_base64_decode(_out,  _in,  _expect_padding,  _no_trailing)   		fr_base64_decode_nstd(NULL, _out,  _in, _expect_padding, _no_trailing, fr_base64_alphabet_decode) | 
|   | 
| #define  | FR_BASE64_ENC_LENGTH(_inlen)   ((((_inlen) + 2) / 3) * 4) | 
|   | Encode/decode binary data using printable characters (base64 format)  
  | 
|   | 
| #define  | fr_base64_encode(_out,  _in,  _add_padding)   		fr_base64_encode_nstd(_out, _in, _add_padding, fr_base64_alphabet_encode) | 
|   | 
| #define  | fr_is_base64(_c)   fr_is_base64_nstd(_c, fr_base64_alphabet_decode) | 
|   | 
 | 
| ssize_t  | fr_base64_decode_nstd (fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in, bool expect_padding, bool no_trailing, uint8_t const alphabet[static UINT8_MAX])) | 
|   | 
| size_t  | fr_base64_encode (char *restrict out, size_t outlen, uint8_t const *restrict in, size_t inlen) | 
|   | 
| ssize_t  | fr_base64_encode_nstd (fr_sbuff_t *out, fr_dbuff_t *in, bool add_padding, char const alphabet[static UINT8_MAX]) | 
|   | Base 64 encode binary data.  
  | 
|   | 
| static bool  | fr_is_base64_nstd (char c, uint8_t const alphabet[static UINT8_MAX]) | 
|   | Check if char is in Base64 alphabet.  
  | 
|   | 
◆ FR_BASE64_DEC_LENGTH
      
        
          | #define FR_BASE64_DEC_LENGTH | 
          ( | 
            | 
          _inlen | ) | 
             ((3 * ((_inlen) / 4)) + 2) | 
        
      
 
 
◆ fr_base64_decode
◆ FR_BASE64_ENC_LENGTH
      
        
          | #define FR_BASE64_ENC_LENGTH | 
          ( | 
            | 
          _inlen | ) | 
             ((((_inlen) + 2) / 3) * 4) | 
        
      
 
 
◆ fr_base64_encode
◆ fr_is_base64
◆ fr_base64_decode_nstd()
◆ fr_base64_encode()
◆ fr_base64_encode_nstd()
Base 64 encode binary data. 
Base64 encode in bytes to base64, writing to out.
- Parameters
 - 
  
    | [out] | out | Where to write Base64 string.  | 
    | [in] | in | Data to encode.  | 
    | [in] | add_padding | Add padding bytes.  | 
    | [in] | alphabet | to use for encoding.  | 
  
   
- Returns
 
- Amount of data we wrote to the buffer.
 
- <0 the number of bytes we would have needed in the ouput buffer. 
 
Definition at line 326 of file base64.c.
 
 
◆ fr_is_base64_nstd()
  
  
      
        
          | static bool fr_is_base64_nstd  | 
          ( | 
          char  | 
          c,  | 
         
        
           | 
           | 
          uint8_t const  | 
          alphabet[static UINT8_MAX]  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Check if char is in Base64 alphabet. 
Note that '=' is padding and not considered to be part of the alphabet.
- Parameters
 - 
  
    | [in] | c | char to check.  | 
    | [in] | alphabet | to use.  | 
  
   
- Returns
 
- true if c is a character from the Base64 alphabet.
 
- false if character is not in the Base64 alphabet. 
 
Definition at line 61 of file base64.h.
 
 
◆ fr_base64_alphabet_decode
◆ fr_base64_alphabet_encode
  
  
      
        
          | char const fr_base64_alphabet_encode[UINT8_MAX] | 
         
       
   | 
  
extern   | 
  
 
 
◆ fr_base64_url_alphabet_decode
◆ fr_base64_url_alphabet_encode
  
  
      
        
          | char const fr_base64_url_alphabet_encode[UINT8_MAX] | 
         
       
   | 
  
extern   |