The module to encrypt data using block cipher. More...
#include <ndn-cxx/security/transform/block-cipher.hpp>
Public Member Functions | |
BlockCipher (BlockCipherAlgorithm algo, CipherOperator op, span< const uint8_t > key, span< const uint8_t > iv) | |
Create a block cipher. More... | |
~BlockCipher () final | |
void | end () |
Close the input interface of a module. More... | |
size_t | getIndex () const |
Get the module index. More... | |
bool | isEnd () const |
Check if the input interface of a module is closed. More... | |
void | setIndex (size_t index) |
Set the module index. More... | |
size_t | write (const uint8_t *buf, size_t size) |
size_t | write (span< const uint8_t > buf) |
Accept input data and perform transformation. More... | |
Protected Types | |
using | OBuffer = std::vector< uint8_t > |
Protected Member Functions | |
void | appendChain (unique_ptr< Downstream > tail) |
Connect to the next transformation module. More... | |
void | flushAllOutput () |
Read the all the content from output buffer and write it into next module. More... | |
void | flushOutputBuffer () |
Read the content from output buffer and write it into next module. More... | |
Downstream * | getNext () |
bool | isOutputBufferEmpty () const |
Check if output buffer is empty. More... | |
void | setOutputBuffer (unique_ptr< OBuffer > buffer) |
Set output buffer to buffer . More... | |
Protected Attributes | |
unique_ptr< Downstream > | m_next |
The module to encrypt data using block cipher.
The padding scheme of the block cipher is set to the OpenSSL default, which is PKCS padding.
Definition at line 38 of file block-cipher.hpp.
|
protectedinherited |
Definition at line 195 of file transform-base.hpp.
ndn::security::transform::BlockCipher::BlockCipher | ( | BlockCipherAlgorithm | algo, |
CipherOperator | op, | ||
span< const uint8_t > | key, | ||
span< const uint8_t > | iv | ||
) |
Create a block cipher.
algo | The block cipher algorithm to use. |
op | The operation to perform (encrypt or decrypt). |
key | The symmetric key. |
iv | The initialization vector. |
Definition at line 52 of file block-cipher.cpp.
|
finaldefault |
|
protectedinherited |
Connect to the next transformation module.
Definition at line 56 of file transform-base.cpp.
|
inherited |
Close the input interface of a module.
This method will notify this module that there is no more input and that the module should finalize transformation.
Although end() can be invoked multiple times, only the first invocation takes effect.
Definition at line 46 of file transform-base.cpp.
|
protectedinherited |
Read the all the content from output buffer and write it into next module.
Definition at line 78 of file transform-base.cpp.
|
protectedinherited |
Read the content from output buffer and write it into next module.
It is not guaranteed that all the content in output buffer will be flushed to next module.
Definition at line 68 of file transform-base.cpp.
|
inlineinherited |
Get the module index.
Definition at line 137 of file transform-base.hpp.
|
inlineprotectedinherited |
Definition at line 179 of file transform-base.hpp.
|
inlineinherited |
Check if the input interface of a module is closed.
Definition at line 119 of file transform-base.hpp.
|
protectedinherited |
Check if output buffer is empty.
Definition at line 94 of file transform-base.cpp.
|
inlineinherited |
Set the module index.
Definition at line 128 of file transform-base.hpp.
|
protectedinherited |
Set output buffer to buffer
.
Definition at line 86 of file transform-base.cpp.
|
inlineinherited |
Definition at line 99 of file transform-base.hpp.
|
inherited |
Accept input data and perform transformation.
An upstream module should call this method to write data into this module. The written data will be transformed and the result will be written into the next downstream module.
An upstream module can keep calling this method to until end() is called, which indicates the end of input. After that, calling this method will cause Error.
If a Downstream implementation expects structured input (e.g., hex decoding requires byte-pair), it should not return less than size if final portion of input is not a complete record.
Error | if this module is closed or transformation error happens. |
Definition at line 35 of file transform-base.cpp.
|
protectedinherited |
Definition at line 185 of file transform-base.hpp.