Botan  2.4.0
Crypto and TLS for C++11
cryptobox.h
Go to the documentation of this file.
1 /*
2 * Cryptobox Message Routines
3 * (C) 2009 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_CRYPTOBOX_H_
9 #define BOTAN_CRYPTOBOX_H_
10 
11 #include <string>
12 #include <botan/symkey.h>
13 
14 namespace Botan {
15 
16 class RandomNumberGenerator;
17 
18 /**
19 * This namespace holds various high-level crypto functions
20 */
21 namespace CryptoBox {
22 
23 /**
24 * Encrypt a message using a passphrase
25 * @param input the input data
26 * @param input_len the length of input in bytes
27 * @param passphrase the passphrase used to encrypt the message
28 * @param rng a ref to a random number generator, such as AutoSeeded_RNG
29 */
30 BOTAN_PUBLIC_API(2,0) std::string encrypt(const uint8_t input[], size_t input_len,
31  const std::string& passphrase,
32  RandomNumberGenerator& rng);
33 
34 
35 /**
36 * Decrypt a message encrypted with CryptoBox::encrypt
37 * @param input the input data
38 * @param input_len the length of input in bytes
39 * @param passphrase the passphrase used to encrypt the message
40 */
42 secure_vector<uint8_t>
43 decrypt_bin(const uint8_t input[], size_t input_len,
44  const std::string& passphrase);
45 
46 /**
47 * Decrypt a message encrypted with CryptoBox::encrypt
48 * @param input the input data
49 * @param passphrase the passphrase used to encrypt the message
50 */
52 secure_vector<uint8_t>
53 decrypt_bin(const std::string& input,
54  const std::string& passphrase);
55 
56 /**
57 * Decrypt a message encrypted with CryptoBox::encrypt
58 * @param input the input data
59 * @param input_len the length of input in bytes
60 * @param passphrase the passphrase used to encrypt the message
61 */
63 std::string decrypt(const uint8_t input[], size_t input_len,
64  const std::string& passphrase);
65 
66 /**
67 * Decrypt a message encrypted with CryptoBox::encrypt
68 * @param input the input data
69 * @param passphrase the passphrase used to encrypt the message
70 */
72 std::string decrypt(const std::string& input,
73  const std::string& passphrase);
74 
75 }
76 
77 }
78 
79 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: bigint.h:635
secure_vector< uint8_t > decrypt_bin(const uint8_t input[], size_t input_len, const std::string &passphrase)
Definition: cryptobox.cpp:98
std::string decrypt(const uint8_t input[], size_t input_len, const std::string &passphrase)
Definition: cryptobox.cpp:162
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88
std::string encrypt(const uint8_t input[], size_t input_len, const std::string &passphrase, RandomNumberGenerator &rng)
Definition: cryptobox.cpp:43