By carson | Published: February 28, 2007
Someone asked for an example of decoding with OpenSSL on the Howto base64 encode with C/C++ and OpenSSL post. So here it is:
#include <string.h>
#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <openssl/evp.h>
#include <openssl/bio.h>
#include <openssl/buffer.h>
char *unbase64(unsigned char *input, int length);
int main(int argc, char **argv)
{
char *output = unbase64("WU9ZTyEA\n\0", strlen("WU9ZTyEA\n\0"));
printf("Unbase64: *%s*\n", output);
free(output);
}
char *unbase64(unsigned char *input, int length)
{
BIO *b64, *bmem;
[...]
Posted in programming | Also tagged C/C++, openssl
By carson | Published: April 11, 2006
I've been doing a little C programming lately and I have found that if you have a up to date distribution of linux there are a lot of libraries out there that make doing things you do in other languages like java easier.
Posted in programming | Also tagged C/C++, openssl
Howto base64 decode with C/C++ and OpenSSL