diff options
author | Jack Lloyd <[email protected]> | 2017-11-19 21:38:37 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-11-19 21:38:37 -0500 |
commit | 30367246fce5615b3a0f2b9da0a3d614509cbbb6 (patch) | |
tree | daf6b5a425fe5abdb77b37301b950c3422fb1937 /src/lib/misc/nist_keywrap/nist_keywrap.h | |
parent | 148f43b60917d5c6b8d0ad1204cd51e1841a2855 (diff) | |
parent | fea9c14d9696615f9d1cf52e0bb578c8a54c2c6a (diff) |
Merge #1301 Add AES key wrap with padding
Diffstat (limited to 'src/lib/misc/nist_keywrap/nist_keywrap.h')
-rw-r--r-- | src/lib/misc/nist_keywrap/nist_keywrap.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/lib/misc/nist_keywrap/nist_keywrap.h b/src/lib/misc/nist_keywrap/nist_keywrap.h new file mode 100644 index 000000000..022b4016f --- /dev/null +++ b/src/lib/misc/nist_keywrap/nist_keywrap.h @@ -0,0 +1,67 @@ +/* +* (C) 2011,2017 Jack Lloyd +* +* Botan is released under the Simplified BSD License (see license.txt) +*/ + +#ifndef BOTAN_NIST_KEY_WRAP_H_ +#define BOTAN_NIST_KEY_WRAP_H_ + +#include <botan/secmem.h> + +namespace Botan { + +class BlockCipher; + +/** +* Key wrap. See RFC 3394 and NIST SP800-38F +* @param input the value to be encrypted +* @param input_len length of input, must be a multiple of 8 +* @param bc a keyed 128-bit block cipher that will be used to encrypt input +* @return input encrypted under NIST key wrap algorithm +*/ +std::vector<uint8_t> BOTAN_PUBLIC_API(2,4) +nist_key_wrap(const uint8_t input[], + size_t input_len, + const BlockCipher& bc); + +/** +* @param input the value to be decrypted, output of nist_key_wrap +* @param input_len length of input +* @param bc a keyed 128-bit block cipher that will be used to decrypt input +* @return input decrypted under NIST key wrap algorithm +* Throws an exception if decryption fails. +*/ +secure_vector<uint8_t> BOTAN_PUBLIC_API(2,4) +nist_key_unwrap(const uint8_t input[], + size_t input_len, + const BlockCipher& bc); + +/** +* KWP (key wrap with padding). See RFC 5649 and NIST SP800-38F +* @param input the value to be encrypted +* @param input_len length of input +* @param bc a keyed 128-bit block cipher that will be used to encrypt input +* @return input encrypted under NIST key wrap algorithm +*/ +std::vector<uint8_t> BOTAN_PUBLIC_API(2,4) +nist_key_wrap_padded(const uint8_t input[], + size_t input_len, + const BlockCipher& bc); + +/** +* @param input the value to be decrypted, output of nist_key_wrap +* @param input_len length of input +* @param bc a keyed 128-bit block cipher that will be used to decrypt input +* @return input decrypted under NIST key wrap algorithm +* Throws an exception if decryption fails. +*/ +secure_vector<uint8_t> BOTAN_PUBLIC_API(2,4) +nist_key_unwrap_padded(const uint8_t input[], + size_t input_len, + const BlockCipher& bc); + + +} + +#endif |