summaryrefslogtreecommitdiffabout
path: root/lib/util.cc
Unidiff
Diffstat (limited to 'lib/util.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/util.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/util.cc b/lib/util.cc
index 94e09ed..26be66a 100644
--- a/lib/util.cc
+++ b/lib/util.cc
@@ -1,26 +1,27 @@
1#include <errno.h> 1#include <errno.h>
2#include <cassert> 2#include <cassert>
3#include <cstring>
3#include <vector> 4#include <vector>
4#include <string> 5#include <string>
5#include <openssl/bio.h> 6#include <openssl/bio.h>
6#include <openssl/evp.h> 7#include <openssl/evp.h>
7#include <curl/curl.h> 8#include <curl/curl.h>
8#include "opkele/util.h" 9#include "opkele/util.h"
9#include "opkele/exception.h" 10#include "opkele/exception.h"
10 11
11namespace opkele { 12namespace opkele {
12 using namespace std; 13 using namespace std;
13 14
14 namespace util { 15 namespace util {
15 16
16 /* 17 /*
17 * base64 18 * base64
18 */ 19 */
19 string encode_base64(const void *data,size_t length) { 20 string encode_base64(const void *data,size_t length) {
20 BIO *b64 = 0, *bmem = 0; 21 BIO *b64 = 0, *bmem = 0;
21 try { 22 try {
22 b64 = BIO_new(BIO_f_base64()); 23 b64 = BIO_new(BIO_f_base64());
23 if(!b64) 24 if(!b64)
24 throw exception_openssl(OPKELE_CP_ "failed to BIO_new() base64 encoder"); 25 throw exception_openssl(OPKELE_CP_ "failed to BIO_new() base64 encoder");
25 BIO_set_flags(b64,BIO_FLAGS_BASE64_NO_NL); 26 BIO_set_flags(b64,BIO_FLAGS_BASE64_NO_NL);
26 bmem = BIO_new(BIO_s_mem()); 27 bmem = BIO_new(BIO_s_mem());