dav/utils.c

changeset 7
d9bdd5a22c1d
parent 5
88625853ae74
child 11
5db6178d8b58
--- a/dav/utils.c	Mon Aug 12 14:55:31 2013 +0200
+++ b/dav/utils.c	Mon Aug 12 15:34:40 2013 +0200
@@ -34,6 +34,12 @@
 #include <libxml/tree.h>
 #include <curl/curl.h>
 
+#include <openssl/sha.h>
+#include <openssl/hmac.h>
+#include <openssl/evp.h>
+#include <openssl/bio.h>
+#include <openssl/buffer.h>
+
 #include "utils.h"
 
 
@@ -150,3 +156,19 @@
     return NULL;
 }
 
+
+
+char* util_base64decode(char* in) {
+    size_t len = strlen(in);
+    char *out = calloc(1, len);
+    
+    BIO* b = BIO_new_mem_buf(in, len);
+    BIO *d = BIO_new(BIO_f_base64());
+    BIO_set_flags(d, BIO_FLAGS_BASE64_NO_NL);
+    b = BIO_push(d, b);
+
+    BIO_read(b, out, len);
+    BIO_free_all(b);
+    
+    return out;
+}

mercurial