Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Functions
ffi_keywrap.cpp File Reference
`#include <botan/ffi.h>`
`#include <botan/internal/ffi_util.h>`

Go to the source code of this file.

## Functions
int | botan_key_unwrap3394 (const uint8_t wrapped_key[], size_t wrapped_key_len, const uint8_t kek[], size_t kek_len, uint8_t key[], size_t *key_len)
int | botan_key_wrap3394 (const uint8_t key[], size_t key_len, const uint8_t kek[], size_t kek_len, uint8_t wrapped_key[], size_t *wrapped_key_len)

## Function Documentation

int botan_key_unwrap3394 | ( | const uint8_t | wrapped_key[],
|  | size_t | wrapped_key_len,
|  | const uint8_t | kek[],
|  | size_t | kek_len,
|  | uint8_t | key[],
|  | size_t * | key_len
| ) |  |

Definition at line 34 of file ffi_keywrap.cpp.

References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, Botan_FFI::ffi_guard_thunk(), Botan::rfc3394_keyunwrap(), and Botan_FFI::write_vec_output().

37 {
38 #if defined(BOTAN_HAS_RFC3394_KEYWRAP)
39 return ffi_guard_thunk(__func__, [=]() -> int {
40 const Botan::SymmetricKey kek_sym(kek, kek_len);
41 const Botan::secure_vector<uint8_t> key_ct(wrapped_key, wrapped_key + wrapped_key_len);
42 const Botan::secure_vector<uint8_t> key_pt = Botan::rfc3394_keyunwrap(key_ct, kek_sym);
43 return write_vec_output(key, key_len, key_pt);
44 });
45 #else
46 return BOTAN_FFI_ERROR_NOT_IMPLEMENTED;
47 #endif
48 }
Botan_FFI::ffi_guard_thunk
int ffi_guard_thunk(const char *func_name, std::function< int()> thunk)
Definition: ffi.cpp:89
Botan::OctetString
Definition: symkey.h:19
BOTAN_FFI_ERROR_NOT_IMPLEMENTED
Definition: ffi.h:82
Botan_FFI::write_vec_output
int write_vec_output(uint8_t out[], size_t *out_len, const std::vector< uint8_t, Alloc > &buf)
Definition: ffi_util.h:155
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:65
Botan::rfc3394_keyunwrap
secure_vector< uint8_t > rfc3394_keyunwrap(const secure_vector< uint8_t > &key, const SymmetricKey &kek)
Definition: rfc3394.cpp:28

int botan_key_wrap3394 | ( | const uint8_t | key[],
|  | size_t | key_len,
|  | const uint8_t | kek[],
|  | size_t | kek_len,
|  | uint8_t | wrapped_key[],
|  | size_t * | wrapped_key_len
| ) |  |

Key wrapping as per RFC 3394

Definition at line 18 of file ffi_keywrap.cpp.

References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, Botan_FFI::ffi_guard_thunk(), Botan::rfc3394_keywrap(), and Botan_FFI::write_vec_output().

21 {
22 #if defined(BOTAN_HAS_RFC3394_KEYWRAP)
23 return ffi_guard_thunk(__func__, [=]() -> int {
24 const Botan::SymmetricKey kek_sym(kek, kek_len);
25 const Botan::secure_vector<uint8_t> key_pt(key, key + key_len);
26 const Botan::secure_vector<uint8_t> key_ct = Botan::rfc3394_keywrap(key_pt, kek_sym);
27 return write_vec_output(wrapped_key, wrapped_key_len, key_ct);
28 });
29 #else
30 return BOTAN_FFI_ERROR_NOT_IMPLEMENTED;
31 #endif
32 }
Botan_FFI::ffi_guard_thunk
int ffi_guard_thunk(const char *func_name, std::function< int()> thunk)
Definition: ffi.cpp:89
Botan::OctetString
Definition: symkey.h:19
BOTAN_FFI_ERROR_NOT_IMPLEMENTED
Definition: ffi.h:82
Botan_FFI::write_vec_output
int write_vec_output(uint8_t out[], size_t *out_len, const std::vector< uint8_t, Alloc > &buf)
Definition: ffi_util.h:155
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:65
Botan::rfc3394_keywrap
secure_vector< uint8_t > rfc3394_keywrap(const secure_vector< uint8_t > &key, const SymmetricKey &kek)
Definition: rfc3394.cpp:14