![]() ![]() The only thing to suggest is to find an implementation that writes the data to the disk while the base64 encode / decode is being generated, and not have it string based. If (bindata.size() > (numeric_limits::max() / 4u) * 3u) // convert to_decode into uchar containerĬonst auto output_len = EVP_DecodeBlock(reinterpret_cast(output_buffer.get()), vec_chars.data(), static_cast(vec_chars. Even if you were to barely get by, you've used up a lot of memory that your app may crash somewhere else due to memory exhaustion. ::std::string base64_encode(const ::std::string &bindata) I have done some unit testing on it, so it should work. This one should even handle the edge cases that can cause security problems, like, for example, encoding a string that results in integer overflow because it's too large. I was feeling bored, and I wrote you one in C++. ![]() I find it quite upsetting that it has become the standard API in the crypto world. Personally, I find the OpenSSL API to be so incredibly painful to use, I avoid it unless the cost of avoiding it is extremely high. The only reason I went for openssl is because the solution is already compiled with the libraries. It doesn't even have to be openssl, a simple class or set of functions that do the same thing would be fine, theres a very complicated build process for the solution and I am trying to avoid having to go in there and make multiple changes. This only seems to work for single line strings such as "Start", the moment I introduce complex strings with newlines and spaces etc it fails horribly. Memcpy(buff, bptr->data, bptr->length-1) Ĭhar *decode64(unsigned char *input, int length) I found some code snippets below #include Ĭhar *base64(const unsigned char *input, int length)Ĭhar *buff = (char *)malloc(bptr->length) ![]() I've been trying to figure out the openssl documentation for base64 decoding and encoding. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |