~ubuntu-branches/debian/sid/botan/sid

« back to all changes in this revision

Viewing changes to src/lib/pubkey/pbes2/pbes2.h

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2018-03-01 22:23:25 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20180301222325-7p7vc45gu3hta34d
Tags: 2.4.0-2
* Don't remove .doctrees from the manual if it doesn't exist.
* Don't specify parallel to debhelper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* PKCS #5 v2.0 PBE
 
3
* (C) 1999-2007,2014 Jack Lloyd
 
4
*
 
5
* Botan is released under the Simplified BSD License (see license.txt)
 
6
*/
 
7
 
 
8
#ifndef BOTAN_PBE_PKCS_v20_H_
 
9
#define BOTAN_PBE_PKCS_v20_H_
 
10
 
 
11
#include <botan/alg_id.h>
 
12
#include <chrono>
 
13
 
 
14
namespace Botan {
 
15
 
 
16
class RandomNumberGenerator;
 
17
 
 
18
/**
 
19
* Encrypt with PBES2 from PKCS #5 v2.0
 
20
* @param key_bits the input
 
21
* @param passphrase the passphrase to use for encryption
 
22
* @param msec how many milliseconds to run PBKDF2
 
23
* @param cipher specifies the block cipher to use to encrypt
 
24
* @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
 
25
* @param rng a random number generator
 
26
*/
 
27
std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
 
28
BOTAN_PUBLIC_API(2,0) pbes2_encrypt(const secure_vector<uint8_t>& key_bits,
 
29
                        const std::string& passphrase,
 
30
                        std::chrono::milliseconds msec,
 
31
                        const std::string& cipher,
 
32
                        const std::string& digest,
 
33
                        RandomNumberGenerator& rng);
 
34
 
 
35
/**
 
36
* Encrypt with PBES2 from PKCS #5 v2.0
 
37
* @param key_bits the input
 
38
* @param passphrase the passphrase to use for encryption
 
39
* @param msec how many milliseconds to run PBKDF2
 
40
* @param out_iterations_if_nonnull if not null, set to the number
 
41
* of PBKDF iterations used
 
42
* @param cipher specifies the block cipher to use to encrypt
 
43
* @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
 
44
* @param rng a random number generator
 
45
*/
 
46
std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
 
47
BOTAN_PUBLIC_API(2,1) pbes2_encrypt_msec(const secure_vector<uint8_t>& key_bits,
 
48
                             const std::string& passphrase,
 
49
                             std::chrono::milliseconds msec,
 
50
                             size_t* out_iterations_if_nonnull,
 
51
                             const std::string& cipher,
 
52
                             const std::string& digest,
 
53
                             RandomNumberGenerator& rng);
 
54
 
 
55
/**
 
56
* Encrypt with PBES2 from PKCS #5 v2.0
 
57
* @param key_bits the input
 
58
* @param passphrase the passphrase to use for encryption
 
59
* @param iterations how many iterations to run PBKDF2
 
60
* @param cipher specifies the block cipher to use to encrypt
 
61
* @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
 
62
* @param rng a random number generator
 
63
*/
 
64
std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
 
65
BOTAN_PUBLIC_API(2,1) pbes2_encrypt_iter(const secure_vector<uint8_t>& key_bits,
 
66
                             const std::string& passphrase,
 
67
                             size_t iterations,
 
68
                             const std::string& cipher,
 
69
                             const std::string& digest,
 
70
                             RandomNumberGenerator& rng);
 
71
 
 
72
/**
 
73
* Decrypt a PKCS #5 v2.0 encrypted stream
 
74
* @param key_bits the input
 
75
* @param passphrase the passphrase to use for decryption
 
76
* @param params the PBES2 parameters
 
77
*/
 
78
secure_vector<uint8_t>
 
79
BOTAN_PUBLIC_API(2,0) pbes2_decrypt(const secure_vector<uint8_t>& key_bits,
 
80
                        const std::string& passphrase,
 
81
                        const std::vector<uint8_t>& params);
 
82
 
 
83
}
 
84
 
 
85
#endif