Botan 2.19.3
Crypto and TLS for C&
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
14namespace Botan {
15
16class RandomNumberGenerator;
17
18/**
19* This namespace holds various high-level crypto functions
20*/
21namespace 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*/
30BOTAN_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*/
42secure_vector<uint8_t>
43decrypt_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*/
52secure_vector<uint8_t>
53decrypt_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*/
63std::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*/
72std::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:31
std::string decrypt(const uint8_t input[], size_t input_len, const std::string &passphrase)
std::string encrypt(const uint8_t input[], size_t input_len, const std::string &passphrase, RandomNumberGenerator &rng)
Definition cryptobox.cpp:43
secure_vector< uint8_t > decrypt_bin(const uint8_t input[], size_t input_len, const std::string &passphrase)
Definition cryptobox.cpp:98
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:65
Definition bigint.h:1143