aboutsummaryrefslogtreecommitdiffstats
path: root/doc/manual/cryptobox.rst
blob: a3a0d02b0bd550ac2817182df5bc99d18fb30545 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

Cryptobox
========================================

Encryption using a passphrase
----------------------------------------

.. versionadded:: 1.8.6

This is a set of simple routines that encrypt some data using a
passphrase. There are defined in the header `cryptobox.h`, inside
namespace `Botan::CryptoBox`.

It generates cipher and MAC keys using 8192 iterations of PBKDF2 with
HMAC(SHA-512), then encrypts using Serpent in CTR mode and authenticates using a
HMAC(SHA-512) mac of the ciphertext, truncated to 160 bits.

 .. cpp:function:: std::string encrypt(const byte input[], size_t input_len, \
                                       const std::string& passphrase, \
                                       RandomNumberGenerator& rng)

    Encrypt the contents using *passphrase*.

 .. cpp:function:: std::string decrypt(const byte input[], size_t input_len, \
                                       const std::string& passphrase)

    Decrypts something encrypted with encrypt.

 .. cpp:function:: std::string decrypt(const std::string& input, \
                                       const std::string& passphrase)

    Decrypts something encrypted with encrypt.