| 197 | } |
| 198 | |
| 199 | char* base64Encode(char* text, int textLen, int* b64Len) { |
| 200 | *b64Len = DEFAULT_BUFLEN; |
| 201 | char* b64Text = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *b64Len); |
| 202 | if (!CryptBinaryToStringA((const BYTE*)text, textLen, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, b64Text, (DWORD*)b64Len)) { |
| 203 | printf("CryptBinaryToStringA failed with error code %d", GetLastError()); |
| 204 | HeapFree(GetProcessHeap(), 0, b64Text); |
| 205 | b64Text = NULL; |
| 206 | exit(-1); |
| 207 | } |
| 208 | return b64Text; |
| 209 | } |
| 210 | |
| 211 | char* base64Decode(char* b64Text, int b64TextLen, int* bufferLen) { |
| 212 | *bufferLen = DEFAULT_BUFLEN; |
no outgoing calls
no test coverage detected