Botan  2.7.0
Crypto and TLS for C++11
nist_keywrap.h
Go to the documentation of this file.
1 /*
2 * (C) 2011,2017 Jack Lloyd
3 *
4 * Botan is released under the Simplified BSD License (see license.txt)
5 */
6 
7 #ifndef BOTAN_NIST_KEY_WRAP_H_
8 #define BOTAN_NIST_KEY_WRAP_H_
9 
10 #include <botan/secmem.h>
11 
12 namespace Botan {
13 
14 class BlockCipher;
15 
16 /**
17 * Key wrap. See RFC 3394 and NIST SP800-38F
18 * @param input the value to be encrypted
19 * @param input_len length of input, must be a multiple of 8
20 * @param bc a keyed 128-bit block cipher that will be used to encrypt input
21 * @return input encrypted under NIST key wrap algorithm
22 */
23 std::vector<uint8_t> BOTAN_PUBLIC_API(2,4)
24 nist_key_wrap(const uint8_t input[],
25  size_t input_len,
26  const BlockCipher& bc);
27 
28 /**
29 * @param input the value to be decrypted, output of nist_key_wrap
30 * @param input_len length of input
31 * @param bc a keyed 128-bit block cipher that will be used to decrypt input
32 * @return input decrypted under NIST key wrap algorithm
33 * Throws an exception if decryption fails.
34 */
35 secure_vector<uint8_t> BOTAN_PUBLIC_API(2,4)
36 nist_key_unwrap(const uint8_t input[],
37  size_t input_len,
38  const BlockCipher& bc);
39 
40 /**
41 * KWP (key wrap with padding). See RFC 5649 and NIST SP800-38F
42 * @param input the value to be encrypted
43 * @param input_len length of input
44 * @param bc a keyed 128-bit block cipher that will be used to encrypt input
45 * @return input encrypted under NIST key wrap algorithm
46 */
47 std::vector<uint8_t> BOTAN_PUBLIC_API(2,4)
48 nist_key_wrap_padded(const uint8_t input[],
49  size_t input_len,
50  const BlockCipher& bc);
51 
52 /**
53 * @param input the value to be decrypted, output of nist_key_wrap
54 * @param input_len length of input
55 * @param bc a keyed 128-bit block cipher that will be used to decrypt input
56 * @return input decrypted under NIST key wrap algorithm
57 * Throws an exception if decryption fails.
58 */
59 secure_vector<uint8_t> BOTAN_PUBLIC_API(2,4)
60 nist_key_unwrap_padded(const uint8_t input[],
61  size_t input_len,
62  const BlockCipher& bc);
63 
64 
65 }
66 
67 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: bigint.h:796
std::vector< uint8_t > nist_key_wrap(const uint8_t input[], size_t input_len, const BlockCipher &bc)
secure_vector< uint8_t > nist_key_unwrap_padded(const uint8_t input[], size_t input_len, const BlockCipher &bc)
Definition: alg_id.cpp:13
secure_vector< uint8_t > nist_key_unwrap(const uint8_t input[], size_t input_len, const BlockCipher &bc)
std::vector< uint8_t > nist_key_wrap_padded(const uint8_t input[], size_t input_len, const BlockCipher &bc)
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88