C++23 wrapper around the bfcodec C library.
More...
#include <bfcodecpp.h>
|
|
| BFCodec (const BFCodec &)=delete |
| |
|
BFCodec & | operator= (const BFCodec &)=delete |
| |
|
| BFCodec (BFCodec &&other) noexcept |
| |
|
BFCodec & | operator= (BFCodec &&other) noexcept |
| |
| std::expected< void, BFCodecError > | expandKey (std::span< const std::byte > key) |
| | Expand key into the codec state (calls bfcodec_expand_key).
|
| |
| std::expected< void, BFCodecError > | decrypt (std::span< std::byte > data, std::span< const std::byte, 8 > iv) |
| | Decrypt data in place with CBC.
|
| |
| std::expected< void, BFCodecError > | encrypt (std::span< std::byte > data, std::span< const std::byte, 8 > iv) |
| | Encrypt data in place with CBC.
|
| |
C++23 wrapper around the bfcodec C library.
Use create() to obtain a codec; expandKey(), decrypt(), and encrypt() return std::expected.
◆ create()
Create a codec instance (calls bfcodec_init()).
- Returns
- The codec on success, or std::unexpected(BFCodecError::InitFailed) on failure.
◆ decrypt()
| std::expected< void, BFCodecError > BFCodec::decrypt |
( |
std::span< std::byte > |
data, |
|
|
std::span< const std::byte, 8 > |
iv |
|
) |
| |
Decrypt data in place with CBC.
- Parameters
-
| data | Buffer to decrypt; data.size() must be a multiple of 8. |
| iv | Initialisation vector; must be exactly 8 bytes. |
- Returns
- void on success, or std::unexpected(BFCodecError) on failure.
◆ encrypt()
| std::expected< void, BFCodecError > BFCodec::encrypt |
( |
std::span< std::byte > |
data, |
|
|
std::span< const std::byte, 8 > |
iv |
|
) |
| |
Encrypt data in place with CBC.
- Parameters
-
| data | Buffer to encrypt; data.size() must be a multiple of 8. |
| iv | Initialisation vector; must be exactly 8 bytes. |
- Returns
- void on success, or std::unexpected(BFCodecError) on failure.
◆ expandKey()
| std::expected< void, BFCodecError > BFCodec::expandKey |
( |
std::span< const std::byte > |
key | ) |
|
Expand key into the codec state (calls bfcodec_expand_key).
- Parameters
-
| key | Key bytes; may be any non-empty length. |
- Returns
- void on success, or std::unexpected(BFCodecError) on failure.
◆ message()
Human-readable message for BFCodecError.
- Parameters
-
- Returns
- A string message describing the error.
The documentation for this class was generated from the following files: