2 * Base64 encoding/decoding (RFC1341) - test program
3 * Copyright (c) 2005, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #include "utils/includes.h"
17 #include "utils/base64.h"
19 int main(int argc, char *argv[])
23 unsigned char *buf, *e;
26 printf("Usage: base64 <encode|decode> <in file> <out file>\n");
30 buf = (unsigned char *) os_readfile(argv[2], &len);
34 if (strcmp(argv[1], "encode") == 0)
35 e = base64_encode(buf, len, &elen);
37 e = base64_decode(buf, len, &elen);
40 f = fopen(argv[3], "w");
43 fwrite(e, 1, elen, f);