Botan  1.11.15
src/lib/misc/cryptobox/cryptobox.h
Go to the documentation of this file.
00001 /*
00002 * Cryptobox Message Routines
00003 * (C) 2009 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_CRYPTOBOX_H__
00009 #define BOTAN_CRYPTOBOX_H__
00010 
00011 #include <string>
00012 #include <botan/rng.h>
00013 #include <botan/symkey.h>
00014 
00015 namespace Botan {
00016 
00017 /**
00018 * This namespace holds various high-level crypto functions
00019 */
00020 namespace CryptoBox {
00021 
00022 /**
00023 * Encrypt a message using a passphrase
00024 * @param input the input data
00025 * @param input_len the length of input in bytes
00026 * @param passphrase the passphrase used to encrypt the message
00027 * @param rng a ref to a random number generator, such as AutoSeeded_RNG
00028 */
00029 BOTAN_DLL std::string encrypt(const byte input[], size_t input_len,
00030                               const std::string& passphrase,
00031                               RandomNumberGenerator& rng);
00032 
00033 
00034 /**
00035 * Decrypt a message encrypted with CryptoBox::encrypt
00036 * @param input the input data
00037 * @param input_len the length of input in bytes
00038 * @param passphrase the passphrase used to encrypt the message
00039 */
00040 BOTAN_DLL std::string decrypt(const byte input[], size_t input_len,
00041                               const std::string& passphrase);
00042 
00043 /**
00044 * Decrypt a message encrypted with CryptoBox::encrypt
00045 * @param input the input data
00046 * @param passphrase the passphrase used to encrypt the message
00047 */
00048 BOTAN_DLL std::string decrypt(const std::string& input,
00049                               const std::string& passphrase);
00050 
00051 }
00052 
00053 }
00054 
00055 #endif