Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 */
41 BOTAN_PUBLIC_API(2,3)
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 */
51 BOTAN_PUBLIC_API(2,3)
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 */
62 BOTAN_PUBLIC_API(2,0)
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 */
71 BOTAN_PUBLIC_API(2,0)
72 std::string decrypt(const std::string& input,
73 const std::string& passphrase);
74
75 }
76
77 }
78
79 #endif
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
std
Definition: bigint.h:1135
Botan::CryptoBox::decrypt_bin
secure_vector< uint8_t > decrypt_bin(const uint8_t input[], size_t input_len, const std::string &passphrase)
Definition: cryptobox.cpp:98
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:65
Botan::CryptoBox::decrypt
std::string decrypt(const uint8_t input[], size_t input_len, const std::string &passphrase)
Definition: cryptobox.cpp:162
Botan
Definition: alg_id.cpp:13
Botan::CryptoBox::encrypt
std::string encrypt(const uint8_t input[], size_t input_len, const std::string &passphrase, RandomNumberGenerator &rng)
Definition: cryptobox.cpp:43