diff options
author | Jeffrey Walton <noloader@gmail.com> | 2015-11-05 01:59:46 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2015-11-05 01:59:46 -0500 |
commit | 48809d4e85c125814425c621d8d0d89f95405924 (patch) | |
tree | 1010fd16c4b1199f3d27dd726dda241a2bd29f83 /base64.h | |
parent | 025337a94aceb75d188149db70c2094673772816 (diff) | |
download | cryptopp-git-48809d4e85c125814425c621d8d0d89f95405924.tar.gz |
CRYPTOPP 5.6.3 RC6 checkin
Diffstat (limited to 'base64.h')
-rw-r--r-- | base64.h | 147 |
1 files changed, 82 insertions, 65 deletions
@@ -1,65 +1,82 @@ -#ifndef CRYPTOPP_BASE64_H -#define CRYPTOPP_BASE64_H - -#include "basecode.h" - -NAMESPACE_BEGIN(CryptoPP) - -//! Base64 Encoder Class -// https://tools.ietf.org/html/rfc4648#section-4 -class Base64Encoder : public SimpleProxyFilter -{ -public: - Base64Encoder(BufferedTransformation *attachment = NULL, bool insertLineBreaks = true, int maxLineLength = 72) - : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment) - { - IsolatedInitialize(MakeParameters(Name::InsertLineBreaks(), insertLineBreaks)(Name::MaxLineLength(), maxLineLength)); - } - - void IsolatedInitialize(const NameValuePairs ¶meters); -}; - -//! Base64 Decoder Class -// https://tools.ietf.org/html/rfc4648#section-4 -class Base64Decoder : public BaseN_Decoder -{ -public: - Base64Decoder(BufferedTransformation *attachment = NULL) - : BaseN_Decoder(GetDecodingLookupArray(), 6, attachment) {} - - void IsolatedInitialize(const NameValuePairs ¶meters) {} - -private: - static const int * CRYPTOPP_API GetDecodingLookupArray(); -}; - -//! Base64 URL Encoder Class -// https://tools.ietf.org/html/rfc4648#section-5 -class Base64URLEncoder : public SimpleProxyFilter -{ -public: - Base64URLEncoder(BufferedTransformation *attachment = NULL, bool insertLineBreaks = false, int maxLineLength = -1) - : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment) - { - IsolatedInitialize(MakeParameters(Name::InsertLineBreaks(), insertLineBreaks)(Name::MaxLineLength(), maxLineLength)); - } - - void IsolatedInitialize(const NameValuePairs ¶meters); -}; - -//! Base64 URL Decoder Class -class Base64URLDecoder : public BaseN_Decoder -{ -public: - Base64URLDecoder(BufferedTransformation *attachment = NULL) - : BaseN_Decoder(GetDecodingLookupArray(), 6, attachment) {} - - void IsolatedInitialize(const NameValuePairs ¶meters) {} - -private: - static const int * CRYPTOPP_API GetDecodingLookupArray(); -}; - -NAMESPACE_END - -#endif +// .h - written and placed in the public domain by Wei Dai
+
+//! \file
+//! \brief Class files for the Base64Encoder, Base64Decoder, Base64URLEncoder and Base64URLDecoder
+
+#ifndef CRYPTOPP_BASE64_H
+#define CRYPTOPP_BASE64_H
+
+#include "cryptlib.h"
+#include "basecode.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+//! \class Base64Encoder
+//! \brief Base64 encodes data
+//! \details Base64 encodes data per RFC 4648 (http://tools.ietf.org/html/rfc4648#section-4)
+//! \details To specify alternative alpahabet or code, call Initialize() with EncodingLookupArray parameter.
+class Base64Encoder : public SimpleProxyFilter
+{
+public:
+ Base64Encoder(BufferedTransformation *attachment = NULL, bool insertLineBreaks = true, int maxLineLength = 72)
+ : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
+ {
+ IsolatedInitialize(MakeParameters(Name::InsertLineBreaks(), insertLineBreaks)(Name::MaxLineLength(), maxLineLength));
+ }
+
+ void IsolatedInitialize(const NameValuePairs ¶meters);
+};
+
+//! \class Base64Decoder
+//! \brief Base64 decodes data
+//! \details Base64 decodes data per RFC 4648 (http://tools.ietf.org/html/rfc4648#section-4)
+//! \details To specify alternative alpahabet or code, call Initialize() with EncodingLookupArray parameter.
+class Base64Decoder : public BaseN_Decoder
+{
+public:
+ Base64Decoder(BufferedTransformation *attachment = NULL)
+ : BaseN_Decoder(GetDecodingLookupArray(), 6, attachment) {}
+
+ void IsolatedInitialize(const NameValuePairs ¶meters)
+ {CRYPTOPP_UNUSED(parameters);}
+
+private:
+ static const int * CRYPTOPP_API GetDecodingLookupArray();
+};
+
+//! \class Base64URLEncoder
+//! \brief Base64 encodes data using a web safe alphabet
+//! \details Base64 encodes data using a web safe alphabet per RFC 4648 (http://tools.ietf.org/html/rfc4648#section-5)
+//! \details To specify alternative alpahabet or code, call Initialize() with EncodingLookupArray parameter.
+class Base64URLEncoder : public SimpleProxyFilter
+{
+public:
+ Base64URLEncoder(BufferedTransformation *attachment = NULL, bool insertLineBreaks = false, int maxLineLength = -1)
+ : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
+ {
+ IsolatedInitialize(MakeParameters(Name::InsertLineBreaks(), insertLineBreaks)(Name::MaxLineLength(), maxLineLength));
+ }
+
+ void IsolatedInitialize(const NameValuePairs ¶meters);
+};
+
+//! \class Base64URLDecoder
+//! \brief Base64 decodes data using a web safe alphabet
+//! \details Base64 decodes data using a web safe alphabet per RFC 4648 (http://tools.ietf.org/html/rfc4648#section-5)
+//! \details To specify alternative alpahabet or code, call Initialize() with EncodingLookupArray parameter.
+class Base64URLDecoder : public BaseN_Decoder
+{
+public:
+ Base64URLDecoder(BufferedTransformation *attachment = NULL)
+ : BaseN_Decoder(GetDecodingLookupArray(), 6, attachment) {}
+
+ void IsolatedInitialize(const NameValuePairs ¶meters)
+ {CRYPTOPP_UNUSED(parameters);}
+
+private:
+ static const int * CRYPTOPP_API GetDecodingLookupArray();
+};
+
+NAMESPACE_END
+
+#endif
|