diff options
author | lloyd <[email protected]> | 2010-06-17 21:48:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-06-17 21:48:55 +0000 |
commit | c06b260b3328c5ce4be44c4f1a88feb55ee3dbc4 (patch) | |
tree | 41b05df5982b5b2e8a23b55972263d2172d6a9fd /src/codec/openpgp | |
parent | 0eecae9f21172c0a74ad62acaf77148c94a25be7 (diff) | |
parent | 3dde5683f69b9cb9f558bfb18087ce35fbbec78a (diff) |
propagate from branch 'net.randombit.botan' (head 294e2082ce9231d6165276e2f2a4153a0116aca3)
to branch 'net.randombit.botan.c++0x' (head 0b695fad10f924601e07b009fcd781191fafcb28)
Diffstat (limited to 'src/codec/openpgp')
-rw-r--r-- | src/codec/openpgp/openpgp.cpp | 26 | ||||
-rw-r--r-- | src/codec/openpgp/openpgp.h | 53 |
2 files changed, 52 insertions, 27 deletions
diff --git a/src/codec/openpgp/openpgp.cpp b/src/codec/openpgp/openpgp.cpp index f55caf1c8..ca1ea6d9c 100644 --- a/src/codec/openpgp/openpgp.cpp +++ b/src/codec/openpgp/openpgp.cpp @@ -13,14 +13,13 @@ namespace Botan { -namespace OpenPGP { - /* * OpenPGP Base64 encoding */ -std::string encode(const byte input[], u32bit length, - const std::string& label, - const std::map<std::string, std::string>& headers) +std::string PGP_encode( + const byte input[], u32bit length, + const std::string& label, + const std::map<std::string, std::string>& headers) { const std::string PGP_HEADER = "-----BEGIN PGP " + label + "-----\n"; const std::string PGP_TRAILER = "-----END PGP " + label + "-----\n"; @@ -58,18 +57,19 @@ std::string encode(const byte input[], u32bit length, /* * OpenPGP Base64 encoding */ -std::string encode(const byte input[], u32bit length, - const std::string& type) +std::string PGP_encode(const byte input[], u32bit length, + const std::string& type) { std::map<std::string, std::string> empty; - return encode(input, length, type, empty); + return PGP_encode(input, length, type, empty); } /* * OpenPGP Base64 decoding */ -SecureVector<byte> decode(DataSource& source, std::string& label, - std::map<std::string, std::string>& headers) +SecureVector<byte> PGP_decode(DataSource& source, + std::string& label, + std::map<std::string, std::string>& headers) { const u32bit RANDOM_CHAR_LIMIT = 5; @@ -186,13 +186,11 @@ SecureVector<byte> decode(DataSource& source, std::string& label, /* * OpenPGP Base64 decoding */ -SecureVector<byte> decode(DataSource& source, std::string& label) +SecureVector<byte> PGP_decode(DataSource& source, std::string& label) { std::map<std::string, std::string> ignored; - return decode(source, label, ignored); + return PGP_decode(source, label, ignored); } } -} - diff --git a/src/codec/openpgp/openpgp.h b/src/codec/openpgp/openpgp.h index 7021d5675..1e2cf10f0 100644 --- a/src/codec/openpgp/openpgp.h +++ b/src/codec/openpgp/openpgp.h @@ -14,20 +14,47 @@ namespace Botan { -namespace OpenPGP { - -/* -* OpenPGP Base64 encoding/decoding +/** +* @param input the input data +* @param length length of input in bytes +* @param label the human-readable label +* @param headers a set of key/value pairs included in the header */ -BOTAN_DLL std::string encode(const byte[], u32bit, const std::string&, - const std::map<std::string, std::string>&); -BOTAN_DLL SecureVector<byte> decode(DataSource&, std::string&, - std::map<std::string, std::string>&); - -BOTAN_DLL std::string encode(const byte[], u32bit, const std::string&); -BOTAN_DLL SecureVector<byte> decode(DataSource&, std::string&); - -} +BOTAN_DLL std::string PGP_encode( + const byte input[], + u32bit length, + const std::string& label, + const std::map<std::string, std::string>& headers); + +/** +* @param input the input data +* @param length length of input in bytes +* @param label the human-readable label +*/ +BOTAN_DLL std::string PGP_encode( + const byte input[], + u32bit length, + const std::string& label); + +/** +* @param source the input source +* @param label is set to the human-readable label +* @param headers is set to any headers +* @return decoded output as raw binary +*/ +BOTAN_DLL SecureVector<byte> PGP_decode( + DataSource& source, + std::string& label, + std::map<std::string, std::string>& headers); + +/** +* @param source the input source +* @param label is set to the human-readable label +* @return decoded output as raw binary +*/ +BOTAN_DLL SecureVector<byte> PGP_decode( + DataSource& source, + std::string& label); } |