diff options
author | lloyd <[email protected]> | 2009-08-13 08:49:29 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-08-13 08:49:29 +0000 |
commit | 8d078b50b7905080269ca8252477d37fdaed6db4 (patch) | |
tree | d2b607513e05872e42ae4b1e16b5051725220238 /src/cryptobox/cryptobox.h | |
parent | 240141b6df9c142c2046cea78043da4121e14333 (diff) |
Add a new interface CryptoBox which provides basic password-based encryption
in a reasonable way. Low on features, which is rather intentional. There
is a version code included in the format so further extensions are possible, if
warranted.
Inspired by the n-th mailing list request for such a class. Realized it was
probably better that I design such code than random people who just want
'something that works'.
Diffstat (limited to 'src/cryptobox/cryptobox.h')
-rw-r--r-- | src/cryptobox/cryptobox.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/cryptobox/cryptobox.h b/src/cryptobox/cryptobox.h new file mode 100644 index 000000000..a30cb244a --- /dev/null +++ b/src/cryptobox/cryptobox.h @@ -0,0 +1,42 @@ +/* +* Cryptobox Message Routines +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_CRYPTOBOX_H__ +#define BOTAN_CRYPTOBOX_H__ + +#include <string> +#include <botan/rng.h> + +namespace Botan { + +namespace CryptoBox { + +/** +* Encrypt a message +* @param input the input data +* @param input_len the length of input in bytes +* @param passphrase the passphrase used to encrypt the message +* @param rng a ref to a random number generator, such as AutoSeeded_RNG +*/ +BOTAN_DLL std::string encrypt(const byte input[], u32bit input_len, + const std::string& passphrase, + RandomNumberGenerator& rng); + +/** +* Decrypt a message encrypted with CryptoBox::encrypt +* @param input the input data +* @param input_len the length of input in bytes +* @param passphrase the passphrase used to encrypt the message +*/ +BOTAN_DLL std::string decrypt(const byte input[], u32bit input_len, + const std::string& passphrase); + +} + +} + +#endif |