aboutsummaryrefslogtreecommitdiffstats
path: root/src/codec/base64/base64.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-28 20:05:21 +0000
committerlloyd <[email protected]>2010-10-28 20:05:21 +0000
commit7c2ac02f29fd4b5d629e187381baa783b53bd2e4 (patch)
tree9d07a452f0a7bd44a2b9d3aaac16f9d9e692fde5 /src/codec/base64/base64.h
parentb502cefaf0f9396354d58c4c18a78ac7870f6168 (diff)
parent7e4c62045c8216138dbed1c586139a1de7cd7f27 (diff)
propagate from branch 'net.randombit.botan' (head 2841fb518e20d2fe0a374e4f6b08bdbb14d5d158)
to branch 'net.randombit.botan.c++0x' (head 0b9275139d6346bd3aa28d63bf8b8a03851d853d)
Diffstat (limited to 'src/codec/base64/base64.h')
-rw-r--r--src/codec/base64/base64.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/codec/base64/base64.h b/src/codec/base64/base64.h
new file mode 100644
index 000000000..551f3daf8
--- /dev/null
+++ b/src/codec/base64/base64.h
@@ -0,0 +1,55 @@
+/*
+* Base64 Encoding and Decoding
+* (C) 2010 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_BASE64_CODEC_H__
+#define BOTAN_BASE64_CODEC_H__
+
+#include <botan/secmem.h>
+#include <string>
+
+namespace Botan {
+
+/**
+* Perform base64 encoding
+* @param output an array of at least input_length*4/3 bytes
+* @param input is some binary data
+* @param input_length length of input in bytes
+* @param input_consumed is an output parameter which says how many
+* bytes of input were actually consumed. If less than
+* input_length, then the range input[consumed:length]
+* should be passed in later along with more input.
+* @param final_inputs true iff this is the last input, in which case
+ padding chars will be applied if needed
+* @return number of bytes written to output
+*/
+size_t BOTAN_DLL base64_encode(char output[],
+ const byte input[],
+ size_t input_length,
+ size_t& input_consumed,
+ bool final_inputs);
+
+/**
+* Perform base64 encoding
+* @param input some input
+* @param input_length length of input in bytes
+* @param uppercase should output be upper or lower case?
+* @return base64adecimal representation of input
+*/
+std::string BOTAN_DLL base64_encode(const byte input[],
+ size_t input_length);
+
+/**
+* Perform base64 encoding
+* @param input some input
+* @param uppercase should output be upper or lower case?
+* @return base64adecimal representation of input
+*/
+std::string BOTAN_DLL base64_encode(const MemoryRegion<byte>& input);
+
+}
+
+#endif