| 917 | } |
| 918 | |
| 919 | int base64Encode(const unsigned char* in, unsigned int inLength, char** out) |
| 920 | { |
| 921 | auto n = ax::base64::encoded_size(inLength); |
| 922 | // should be enough to store 8-bit buffers in 6-bit buffers |
| 923 | char* tmp = nullptr; |
| 924 | if (n > 0 && (tmp = (char*)malloc(n + 1))) |
| 925 | { |
| 926 | auto ret = ax::base64::encode(tmp, in, inLength); |
| 927 | tmp[ret] = '\0'; |
| 928 | *out = tmp; |
| 929 | return static_cast<int>(ret); |
| 930 | } |
| 931 | *out = nullptr; |
| 932 | return 0; |
| 933 | } |
| 934 | |
| 935 | AX_DLL int base64Decode(const unsigned char* in, unsigned int inLength, unsigned char** out) |
| 936 | { |
no test coverage detected