You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/08 11:08:59 UTC
svn commit: r802325 - in /commons/sandbox/runtime/trunk/src/main/native:
Makefile.in Makefile.msc.in include/acr_crypto.h
Author: mturk
Date: Sat Aug 8 09:08:59 2009
New Revision: 802325
URL: http://svn.apache.org/viewvc?rev=802325&view=rev
Log:
Port APR's base64 encoding
Modified:
commons/sandbox/runtime/trunk/src/main/native/Makefile.in
commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h
Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=802325&r1=802324&r2=802325&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Sat Aug 8 09:08:59 2009
@@ -87,6 +87,7 @@
$(SRCDIR)/shared/nbb.$(OBJ) \
$(SRCDIR)/shared/pointer.$(OBJ) \
$(SRCDIR)/shared/object.$(OBJ) \
+ $(SRCDIR)/shared/base64.$(OBJ) \
$(SRCDIR)/shared/md5.$(OBJ) \
$(SRCDIR)/shared/sha.$(OBJ) \
$(SRCDIR)/shared/string.$(OBJ) \
Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=802325&r1=802324&r2=802325&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Sat Aug 8 09:08:59 2009
@@ -80,6 +80,7 @@
$(SRCDIR)/shared/nbb.$(OBJ) \
$(SRCDIR)/shared/pointer.$(OBJ) \
$(SRCDIR)/shared/object.$(OBJ) \
+ $(SRCDIR)/shared/base64.$(OBJ) \
$(SRCDIR)/shared/md5.$(OBJ) \
$(SRCDIR)/shared/sha.$(OBJ) \
$(SRCDIR)/shared/string.$(OBJ) \
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h?rev=802325&r1=802324&r2=802325&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h Sat Aug 8 09:08:59 2009
@@ -184,6 +184,64 @@
ACR_DECLARE(wchar_t *) ACR_Md5Base16W(const wchar_t *clear, size_t len,
wchar_t *out);
+
+/**
+ * Determine the maximum buffer length required to decode the plain text
+ * string given the encoded string.
+ * @param coded The encoded string
+ * @return the maximum required buffer length for the plain text string
+ * including the terminating zero char.
+ */
+ACR_DECLARE(size_t) ACR_Base64DecodeLen(const char *coded);
+
+/**
+ * Decode a string to plain text
+ * @param dst The destination string for the plain text
+ * @param coded The encoded string
+ * @return the length of the plain text string
+ */
+ACR_DECLARE(size_t) ACR_Base64Decode(unsigned char *dst,
+ const char *coded);
+
+/**
+ * Decode a string to plain text
+ * @param dst The destination string for the plain text
+ * @param coded The encoded string
+ * @return the length of the plain text string
+ */
+ACR_DECLARE(size_t) ACR_Base64DecodeA(char *dst,
+ const char *coded);
+
+/**
+ * Given the length of an un-encrypted string, get the length of the
+ * encrypted string.
+ * @param len the length of an unencrypted string.
+ * @return the length of the string after it is encrypted
+ */
+ACR_DECLARE(size_t) ACR_Base64EncodeLen(size_t len);
+
+/**
+ * Encode a byte buffer using base64encoding.
+ * @param dst The destination string for the encoded string.
+ * @param data The plain data to encode
+ * @param len The length of the plain data
+ * @return the length of the encoded string
+ */
+ACR_DECLARE(size_t) ACR_Base64Encode(char *dst,
+ const unsigned char *data,
+ size_t len);
+
+/**
+ * Encode a text string using base64encoding.
+ * @param dst The destination string for the encoded string.
+ * @param src The original string in plain text
+ * @param len The length of the plain text string
+ * @return the length of the encoded string
+ */
+ACR_DECLARE(size_t) ACR_Base64EncodeA(char *dst,
+ const char *src,
+ size_t len);
+
#ifdef __cplusplus
}
#endif