Botan 3.4.0
Crypto and TLS for C&
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
12namespace Botan {
13
14class 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*/
23std::vector<uint8_t> BOTAN_PUBLIC_API(2, 4)
24 nist_key_wrap(const uint8_t input[], size_t input_len, const BlockCipher& bc);
25
26/**
27* @param input the value to be decrypted, output of nist_key_wrap
28* @param input_len length of input
29* @param bc a keyed 128-bit block cipher that will be used to decrypt input
30* @return input decrypted under NIST key wrap algorithm
31* Throws an exception if decryption fails.
32*/
34 nist_key_unwrap(const uint8_t input[], size_t input_len, const BlockCipher& bc);
35
36/**
37* KWP (key wrap with padding). See RFC 5649 and NIST SP800-38F
38* @param input the value to be encrypted
39* @param input_len length of input
40* @param bc a keyed 128-bit block cipher that will be used to encrypt input
41* @return input encrypted under NIST key wrap algorithm
42*/
43std::vector<uint8_t> BOTAN_PUBLIC_API(2, 4)
44 nist_key_wrap_padded(const uint8_t input[], size_t input_len, const BlockCipher& bc);
45
46/**
47* @param input the value to be decrypted, output of nist_key_wrap
48* @param input_len length of input
49* @param bc a keyed 128-bit block cipher that will be used to decrypt input
50* @return input decrypted under NIST key wrap algorithm
51* Throws an exception if decryption fails.
52*/
54 nist_key_unwrap_padded(const uint8_t input[], size_t input_len, const BlockCipher& bc);
55
56} // namespace Botan
57
58#endif
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
std::vector< uint8_t > nist_key_wrap(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)
secure_vector< uint8_t > nist_key_unwrap_padded(const uint8_t input[], size_t input_len, const BlockCipher &bc)
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61
secure_vector< uint8_t > nist_key_unwrap(const uint8_t input[], size_t input_len, const BlockCipher &bc)